diff --git a/configure b/configure index 162818bfe36a92a59375368e2cf5c7fa9a2e332c..f5c01429bf0122b1b032de699de18bb1185110ef 100755 --- a/configure +++ b/configure @@ -5515,7 +5515,7 @@ EOF fi -for ac_func in fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen +for ac_func in fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:5522: checking for $ac_func" >&5 @@ -5571,13 +5571,29 @@ fi done +cat > conftest.$ac_ext <<EOF +#line 5576 "configure" +#include "confdefs.h" +#include <unistd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "fdatasync" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_FDATASYNC_DECL 1 +EOF + +fi +rm -f conftest* + + echo $ac_n "checking for PS_STRINGS""... $ac_c" 1>&6 -echo "configure:5576: checking for PS_STRINGS" >&5 +echo "configure:5592: checking for PS_STRINGS" >&5 if eval "test \"`echo '$''{'pgac_cv_var_PS_STRINGS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5581 "configure" +#line 5597 "configure" #include "confdefs.h" #include <machine/vmparam.h> #include <sys/exec.h> @@ -5587,7 +5603,7 @@ PS_STRINGS->ps_nargvstr = 1; PS_STRINGS->ps_argvstr = "foo"; ; return 0; } EOF -if { (eval echo configure:5591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* pgac_cv_var_PS_STRINGS=yes else @@ -5609,12 +5625,12 @@ fi SNPRINTF='' echo $ac_n "checking for snprintf""... $ac_c" 1>&6 -echo "configure:5613: checking for snprintf" >&5 +echo "configure:5629: checking for snprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5618 "configure" +#line 5634 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char snprintf(); below. */ @@ -5637,7 +5653,7 @@ snprintf(); ; return 0; } EOF -if { (eval echo configure:5641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_snprintf=yes" else @@ -5661,12 +5677,12 @@ SNPRINTF='snprintf.o' fi echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 -echo "configure:5665: checking for vsnprintf" >&5 +echo "configure:5681: checking for vsnprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5670 "configure" +#line 5686 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vsnprintf(); below. */ @@ -5689,7 +5705,7 @@ vsnprintf(); ; return 0; } EOF -if { (eval echo configure:5693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vsnprintf=yes" else @@ -5714,7 +5730,7 @@ fi cat > conftest.$ac_ext <<EOF -#line 5718 "configure" +#line 5734 "configure" #include "confdefs.h" #include <stdio.h> EOF @@ -5729,7 +5745,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 5733 "configure" +#line 5749 "configure" #include "confdefs.h" #include <stdio.h> EOF @@ -5746,12 +5762,12 @@ rm -f conftest* # do this one the hard way in case isinf() is a macro echo $ac_n "checking for isinf""... $ac_c" 1>&6 -echo "configure:5750: checking for isinf" >&5 +echo "configure:5766: checking for isinf" >&5 if eval "test \"`echo '$''{'ac_cv_func_isinf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5755 "configure" +#line 5771 "configure" #include "confdefs.h" #include <math.h> @@ -5759,7 +5775,7 @@ int main() { double x = 0.0; int res = isinf(x); ; return 0; } EOF -if { (eval echo configure:5763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_isinf=yes else @@ -5785,12 +5801,12 @@ else for ac_func in fpclass fp_class fp_class_d class do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5789: checking for $ac_func" >&5 +echo "configure:5805: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5794 "configure" +#line 5810 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5813,7 +5829,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5841,12 +5857,12 @@ fi echo $ac_n "checking for getrusage""... $ac_c" 1>&6 -echo "configure:5845: checking for getrusage" >&5 +echo "configure:5861: checking for getrusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_getrusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5850 "configure" +#line 5866 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getrusage(); below. */ @@ -5869,7 +5885,7 @@ getrusage(); ; return 0; } EOF -if { (eval echo configure:5873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getrusage=yes" else @@ -5894,12 +5910,12 @@ fi echo $ac_n "checking for srandom""... $ac_c" 1>&6 -echo "configure:5898: checking for srandom" >&5 +echo "configure:5914: checking for srandom" >&5 if eval "test \"`echo '$''{'ac_cv_func_srandom'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5903 "configure" +#line 5919 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char srandom(); below. */ @@ -5922,7 +5938,7 @@ srandom(); ; return 0; } EOF -if { (eval echo configure:5926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_srandom=yes" else @@ -5947,12 +5963,12 @@ fi echo $ac_n "checking for gethostname""... $ac_c" 1>&6 -echo "configure:5951: checking for gethostname" >&5 +echo "configure:5967: checking for gethostname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5956 "configure" +#line 5972 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostname(); below. */ @@ -5975,7 +5991,7 @@ gethostname(); ; return 0; } EOF -if { (eval echo configure:5979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostname=yes" else @@ -6000,12 +6016,12 @@ fi echo $ac_n "checking for random""... $ac_c" 1>&6 -echo "configure:6004: checking for random" >&5 +echo "configure:6020: checking for random" >&5 if eval "test \"`echo '$''{'ac_cv_func_random'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6009 "configure" +#line 6025 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char random(); below. */ @@ -6028,7 +6044,7 @@ random(); ; return 0; } EOF -if { (eval echo configure:6032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_random=yes" else @@ -6053,12 +6069,12 @@ fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:6057: checking for inet_aton" >&5 +echo "configure:6073: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6062 "configure" +#line 6078 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char inet_aton(); below. */ @@ -6081,7 +6097,7 @@ inet_aton(); ; return 0; } EOF -if { (eval echo configure:6085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -6106,12 +6122,12 @@ fi echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:6110: checking for strerror" >&5 +echo "configure:6126: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6115 "configure" +#line 6131 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strerror(); below. */ @@ -6134,7 +6150,7 @@ strerror(); ; return 0; } EOF -if { (eval echo configure:6138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -6159,12 +6175,12 @@ fi echo $ac_n "checking for strdup""... $ac_c" 1>&6 -echo "configure:6163: checking for strdup" >&5 +echo "configure:6179: checking for strdup" >&5 if eval "test \"`echo '$''{'ac_cv_func_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6168 "configure" +#line 6184 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strdup(); below. */ @@ -6187,7 +6203,7 @@ strdup(); ; return 0; } EOF -if { (eval echo configure:6191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strdup=yes" else @@ -6212,12 +6228,12 @@ fi echo $ac_n "checking for strtol""... $ac_c" 1>&6 -echo "configure:6216: checking for strtol" >&5 +echo "configure:6232: checking for strtol" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6221 "configure" +#line 6237 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strtol(); below. */ @@ -6240,7 +6256,7 @@ strtol(); ; return 0; } EOF -if { (eval echo configure:6244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strtol=yes" else @@ -6265,12 +6281,12 @@ fi echo $ac_n "checking for strtoul""... $ac_c" 1>&6 -echo "configure:6269: checking for strtoul" >&5 +echo "configure:6285: checking for strtoul" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtoul'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6274 "configure" +#line 6290 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strtoul(); below. */ @@ -6293,7 +6309,7 @@ strtoul(); ; return 0; } EOF -if { (eval echo configure:6297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strtoul=yes" else @@ -6318,12 +6334,12 @@ fi echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6 -echo "configure:6322: checking for strcasecmp" >&5 +echo "configure:6338: checking for strcasecmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strcasecmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6327 "configure" +#line 6343 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strcasecmp(); below. */ @@ -6346,7 +6362,7 @@ strcasecmp(); ; return 0; } EOF -if { (eval echo configure:6350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strcasecmp=yes" else @@ -6371,12 +6387,12 @@ fi echo $ac_n "checking for cbrt""... $ac_c" 1>&6 -echo "configure:6375: checking for cbrt" >&5 +echo "configure:6391: checking for cbrt" >&5 if eval "test \"`echo '$''{'ac_cv_func_cbrt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6380 "configure" +#line 6396 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char cbrt(); below. */ @@ -6399,7 +6415,7 @@ cbrt(); ; return 0; } EOF -if { (eval echo configure:6403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_cbrt=yes" else @@ -6420,7 +6436,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for cbrt in -lm""... $ac_c" 1>&6 -echo "configure:6424: checking for cbrt in -lm" >&5 +echo "configure:6440: checking for cbrt in -lm" >&5 ac_lib_var=`echo m'_'cbrt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6428,7 +6444,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 6432 "configure" +#line 6448 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6439,7 +6455,7 @@ int main() { cbrt() ; return 0; } EOF -if { (eval echo configure:6443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6477,12 +6493,12 @@ esac echo $ac_n "checking for rint""... $ac_c" 1>&6 -echo "configure:6481: checking for rint" >&5 +echo "configure:6497: checking for rint" >&5 if eval "test \"`echo '$''{'ac_cv_func_rint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6486 "configure" +#line 6502 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char rint(); below. */ @@ -6505,7 +6521,7 @@ rint(); ; return 0; } EOF -if { (eval echo configure:6509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_rint=yes" else @@ -6526,7 +6542,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for rint in -lm""... $ac_c" 1>&6 -echo "configure:6530: checking for rint in -lm" >&5 +echo "configure:6546: checking for rint in -lm" >&5 ac_lib_var=`echo m'_'rint | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6534,7 +6550,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $HPUXMATHLIB $LIBS" cat > conftest.$ac_ext <<EOF -#line 6538 "configure" +#line 6554 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6545,7 +6561,7 @@ int main() { rint() ; return 0; } EOF -if { (eval echo configure:6549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6574,9 +6590,9 @@ fi # Readline versions < 2.1 don't have rl_completion_append_character echo $ac_n "checking for rl_completion_append_character""... $ac_c" 1>&6 -echo "configure:6578: checking for rl_completion_append_character" >&5 +echo "configure:6594: checking for rl_completion_append_character" >&5 cat > conftest.$ac_ext <<EOF -#line 6580 "configure" +#line 6596 "configure" #include "confdefs.h" #include <stdio.h> #ifdef HAVE_READLINE_H @@ -6589,7 +6605,7 @@ int main() { rl_completion_append_character = 'x'; ; return 0; } EOF -if { (eval echo configure:6593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -6610,7 +6626,7 @@ rm -f conftest* # with earlier Cygwins don't have this declared, although it's in the # library. echo $ac_n "checking whether filename_completion_function is declared""... $ac_c" 1>&6 -echo "configure:6614: checking whether filename_completion_function is declared" >&5 +echo "configure:6630: checking whether filename_completion_function is declared" >&5 if test "$ac_cv_header_readline_h" = yes; then _readline_header='readline.h' elif test "$ac_cv_header_readline_readline_h" = yes; then @@ -6619,7 +6635,7 @@ else _readline_header='xxx' fi cat > conftest.$ac_ext <<EOF -#line 6623 "configure" +#line 6639 "configure" #include "confdefs.h" #include <$_readline_header> EOF @@ -6641,16 +6657,16 @@ rm -f conftest* echo $ac_n "checking for finite""... $ac_c" 1>&6 -echo "configure:6645: checking for finite" >&5 +echo "configure:6661: checking for finite" >&5 cat > conftest.$ac_ext <<EOF -#line 6647 "configure" +#line 6663 "configure" #include "confdefs.h" #include <math.h> int main() { int dummy=finite(1.0); ; return 0; } EOF -if { (eval echo configure:6654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_FINITE 1 @@ -6665,16 +6681,16 @@ fi rm -f conftest* echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6 -echo "configure:6669: checking for sigsetjmp" >&5 +echo "configure:6685: checking for sigsetjmp" >&5 cat > conftest.$ac_ext <<EOF -#line 6671 "configure" +#line 6687 "configure" #include "confdefs.h" #include <setjmp.h> int main() { sigjmp_buf x; sigsetjmp(x, 1); ; return 0; } EOF -if { (eval echo configure:6678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_SIGSETJMP 1 @@ -6694,12 +6710,12 @@ if test x"${enable_syslog+set}" = xset; then case $enable_syslog in yes) echo $ac_n "checking for syslog""... $ac_c" 1>&6 -echo "configure:6698: checking for syslog" >&5 +echo "configure:6714: checking for syslog" >&5 if eval "test \"`echo '$''{'ac_cv_func_syslog'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6703 "configure" +#line 6719 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char syslog(); below. */ @@ -6722,7 +6738,7 @@ syslog(); ; return 0; } EOF -if { (eval echo configure:6726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_syslog=yes" else @@ -6761,19 +6777,19 @@ fi echo $ac_n "checking for optreset""... $ac_c" 1>&6 -echo "configure:6765: checking for optreset" >&5 +echo "configure:6781: checking for optreset" >&5 if eval "test \"`echo '$''{'pgac_cv_var_int_optreset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6770 "configure" +#line 6786 "configure" #include "confdefs.h" #include <unistd.h> int main() { extern int optreset; optreset = 1; ; return 0; } EOF -if { (eval echo configure:6777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* pgac_cv_var_int_optreset=yes else @@ -6795,7 +6811,7 @@ fi echo $ac_n "checking whether long int is 64 bits""... $ac_c" 1>&6 -echo "configure:6799: checking whether long int is 64 bits" >&5 +echo "configure:6815: checking whether long int is 64 bits" >&5 if eval "test \"`echo '$''{'pgac_cv_type_long_int_64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6804,7 +6820,7 @@ else echo "configure: warning: 64 bit arithmetic disabled when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 6808 "configure" +#line 6824 "configure" #include "confdefs.h" typedef long int int64; @@ -6833,7 +6849,7 @@ main() { exit(! does_int64_work()); } EOF -if { (eval echo configure:6837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then pgac_cv_type_long_int_64=yes else @@ -6860,7 +6876,7 @@ fi if test x"$HAVE_LONG_INT_64" = x"no" ; then echo $ac_n "checking whether long long int is 64 bits""... $ac_c" 1>&6 -echo "configure:6864: checking whether long long int is 64 bits" >&5 +echo "configure:6880: checking whether long long int is 64 bits" >&5 if eval "test \"`echo '$''{'pgac_cv_type_long_long_int_64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6869,7 +6885,7 @@ else echo "configure: warning: 64 bit arithmetic disabled when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 6873 "configure" +#line 6889 "configure" #include "confdefs.h" typedef long long int int64; @@ -6898,7 +6914,7 @@ main() { exit(! does_int64_work()); } EOF -if { (eval echo configure:6902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then pgac_cv_type_long_long_int_64=yes else @@ -6929,7 +6945,7 @@ fi if [ x"$HAVE_LONG_LONG_INT_64" = xyes ] ; then if [ x$SNPRINTF = x ] ; then echo $ac_n "checking whether snprintf handles 'long long int' as %lld""... $ac_c" 1>&6 -echo "configure:6933: checking whether snprintf handles 'long long int' as %lld" >&5 +echo "configure:6949: checking whether snprintf handles 'long long int' as %lld" >&5 if test "$cross_compiling" = yes; then echo "$ac_t""assuming not on target machine" 1>&6 # Force usage of our own snprintf, since we cannot test foreign snprintf @@ -6938,7 +6954,7 @@ echo "configure:6933: checking whether snprintf handles 'long long int' as %lld" else cat > conftest.$ac_ext <<EOF -#line 6942 "configure" +#line 6958 "configure" #include "confdefs.h" #include <stdio.h> typedef long long int int64; @@ -6965,7 +6981,7 @@ main() { exit(! does_int64_snprintf_work()); } EOF -if { (eval echo configure:6969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 INT64_FORMAT='"%lld"' @@ -6976,7 +6992,7 @@ else rm -fr conftest* echo "$ac_t""no" 1>&6 echo $ac_n "checking whether snprintf handles 'long long int' as %qd""... $ac_c" 1>&6 -echo "configure:6980: checking whether snprintf handles 'long long int' as %qd" >&5 +echo "configure:6996: checking whether snprintf handles 'long long int' as %qd" >&5 if test "$cross_compiling" = yes; then echo "$ac_t""assuming not on target machine" 1>&6 # Force usage of our own snprintf, since we cannot test foreign snprintf @@ -6985,7 +7001,7 @@ echo "configure:6980: checking whether snprintf handles 'long long int' as %qd" else cat > conftest.$ac_ext <<EOF -#line 6989 "configure" +#line 7005 "configure" #include "confdefs.h" #include <stdio.h> typedef long long int int64; @@ -7012,7 +7028,7 @@ main() { exit(! does_int64_snprintf_work()); } EOF -if { (eval echo configure:7016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 INT64_FORMAT='"%qd"' @@ -7052,12 +7068,12 @@ EOF for ac_func in strtoll strtoq do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7056: checking for $ac_func" >&5 +echo "configure:7072: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7061 "configure" +#line 7077 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7080,7 +7096,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7107,12 +7123,12 @@ done for ac_func in strtoull strtouq do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7111: checking for $ac_func" >&5 +echo "configure:7127: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7116 "configure" +#line 7132 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7135,7 +7151,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7163,7 +7179,7 @@ done echo $ac_n "checking size of unsigned long""... $ac_c" 1>&6 -echo "configure:7167: checking size of unsigned long" >&5 +echo "configure:7183: checking size of unsigned long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7171,7 +7187,7 @@ else ac_cv_sizeof_unsigned_long=4 else cat > conftest.$ac_ext <<EOF -#line 7175 "configure" +#line 7191 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -7182,7 +7198,7 @@ main() exit(0); } EOF -if { (eval echo configure:7186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_unsigned_long=`cat conftestval` else @@ -7208,7 +7224,7 @@ EOF echo $ac_n "checking alignment of short""... $ac_c" 1>&6 -echo "configure:7212: checking alignment of short" >&5 +echo "configure:7228: checking alignment of short" >&5 if eval "test \"`echo '$''{'pgac_cv_alignof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7216,7 +7232,7 @@ else pgac_cv_alignof_short='sizeof(short)' else cat > conftest.$ac_ext <<EOF -#line 7220 "configure" +#line 7236 "configure" #include "confdefs.h" #include <stdio.h> struct { char filler; short field; } mystruct; @@ -7228,7 +7244,7 @@ main() exit(0); } EOF -if { (eval echo configure:7232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then pgac_cv_alignof_short=`cat conftestval` else @@ -7248,7 +7264,7 @@ EOF echo $ac_n "checking alignment of int""... $ac_c" 1>&6 -echo "configure:7252: checking alignment of int" >&5 +echo "configure:7268: checking alignment of int" >&5 if eval "test \"`echo '$''{'pgac_cv_alignof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7256,7 +7272,7 @@ else pgac_cv_alignof_int='sizeof(int)' else cat > conftest.$ac_ext <<EOF -#line 7260 "configure" +#line 7276 "configure" #include "confdefs.h" #include <stdio.h> struct { char filler; int field; } mystruct; @@ -7268,7 +7284,7 @@ main() exit(0); } EOF -if { (eval echo configure:7272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then pgac_cv_alignof_int=`cat conftestval` else @@ -7288,7 +7304,7 @@ EOF echo $ac_n "checking alignment of long""... $ac_c" 1>&6 -echo "configure:7292: checking alignment of long" >&5 +echo "configure:7308: checking alignment of long" >&5 if eval "test \"`echo '$''{'pgac_cv_alignof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7296,7 +7312,7 @@ else pgac_cv_alignof_long='sizeof(long)' else cat > conftest.$ac_ext <<EOF -#line 7300 "configure" +#line 7316 "configure" #include "confdefs.h" #include <stdio.h> struct { char filler; long field; } mystruct; @@ -7308,7 +7324,7 @@ main() exit(0); } EOF -if { (eval echo configure:7312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then pgac_cv_alignof_long=`cat conftestval` else @@ -7329,7 +7345,7 @@ EOF if [ x"$HAVE_LONG_LONG_INT_64" = xyes ] ; then echo $ac_n "checking alignment of long long int""... $ac_c" 1>&6 -echo "configure:7333: checking alignment of long long int" >&5 +echo "configure:7349: checking alignment of long long int" >&5 if eval "test \"`echo '$''{'pgac_cv_alignof_long_long_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7337,7 +7353,7 @@ else pgac_cv_alignof_long_long_int='sizeof(long long int)' else cat > conftest.$ac_ext <<EOF -#line 7341 "configure" +#line 7357 "configure" #include "confdefs.h" #include <stdio.h> struct { char filler; long long int field; } mystruct; @@ -7349,7 +7365,7 @@ main() exit(0); } EOF -if { (eval echo configure:7353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then pgac_cv_alignof_long_long_int=`cat conftestval` else @@ -7370,7 +7386,7 @@ EOF fi echo $ac_n "checking alignment of double""... $ac_c" 1>&6 -echo "configure:7374: checking alignment of double" >&5 +echo "configure:7390: checking alignment of double" >&5 if eval "test \"`echo '$''{'pgac_cv_alignof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7378,7 +7394,7 @@ else pgac_cv_alignof_double='sizeof(double)' else cat > conftest.$ac_ext <<EOF -#line 7382 "configure" +#line 7398 "configure" #include "confdefs.h" #include <stdio.h> struct { char filler; double field; } mystruct; @@ -7390,7 +7406,7 @@ main() exit(0); } EOF -if { (eval echo configure:7394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then pgac_cv_alignof_double=`cat conftestval` else @@ -7428,12 +7444,12 @@ EOF echo $ac_n "checking for POSIX signal interface""... $ac_c" 1>&6 -echo "configure:7432: checking for POSIX signal interface" >&5 +echo "configure:7448: checking for POSIX signal interface" >&5 if eval "test \"`echo '$''{'pgac_cv_func_posix_signals'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7437 "configure" +#line 7453 "configure" #include "confdefs.h" #include <signal.h> @@ -7444,7 +7460,7 @@ act.sa_flags = SA_RESTART; sigaction(0, &act, &oact); ; return 0; } EOF -if { (eval echo configure:7448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* pgac_cv_func_posix_signals=yes else @@ -7474,7 +7490,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7478: checking for $ac_word" >&5 +echo "configure:7494: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TCLSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7510,7 +7526,7 @@ test -n "$TCLSH" && break done echo $ac_n "checking for tclConfig.sh""... $ac_c" 1>&6 -echo "configure:7514: checking for tclConfig.sh" >&5 +echo "configure:7530: checking for tclConfig.sh" >&5 # Let user override test if test -z "$TCL_CONFIG_SH"; then pgac_test_dirs="$with_tclconfig" @@ -7543,7 +7559,7 @@ fi # Check for Tk configuration script tkConfig.sh if test "$with_tk" = yes; then echo $ac_n "checking for tkConfig.sh""... $ac_c" 1>&6 -echo "configure:7547: checking for tkConfig.sh" >&5 +echo "configure:7563: checking for tkConfig.sh" >&5 # Let user override test if test -z "$TK_CONFIG_SH"; then pgac_test_dirs="$with_tkconfig $with_tclconfig" @@ -7582,7 +7598,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7586: checking for $ac_word" >&5 +echo "configure:7602: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NSGMLS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7618,7 +7634,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7622: checking for $ac_word" >&5 +echo "configure:7638: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_JADE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7649,7 +7665,7 @@ done echo $ac_n "checking for DocBook V3.1""... $ac_c" 1>&6 -echo "configure:7653: checking for DocBook V3.1" >&5 +echo "configure:7669: checking for DocBook V3.1" >&5 if eval "test \"`echo '$''{'pgac_cv_check_docbook'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7682,7 +7698,7 @@ have_docbook=$pgac_cv_check_docbook echo $ac_n "checking for DocBook stylesheets""... $ac_c" 1>&6 -echo "configure:7686: checking for DocBook stylesheets" >&5 +echo "configure:7702: checking for DocBook stylesheets" >&5 if eval "test \"`echo '$''{'pgac_cv_path_stylesheets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7721,7 +7737,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7725: checking for $ac_word" >&5 +echo "configure:7741: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_SGMLSPL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/configure.in b/configure.in index 74c19baa8e2c5227113fb9213c0d6f5441bc9121..063bb18564e76de9b82e8132a79b719a92d246a0 100644 --- a/configure.in +++ b/configure.in @@ -772,7 +772,10 @@ PGAC_VAR_INT_TIMEZONE AC_FUNC_ACCEPT_ARGTYPES PGAC_FUNC_GETTIMEOFDAY_1ARG -AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen]) +AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync]) + +dnl Check whether <unistd.h> declares fdatasync(). +AC_EGREP_HEADER(fdatasync, unistd.h, AC_DEFINE(HAVE_FDATASYNC_DECL)) AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS], [AC_TRY_LINK( diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 7c18f0ff5a69564c0b6b12d16d875f4086b88abf..fbc4223034a6c25006b484b3d2c18bcf5079d844 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.53 2001/02/13 20:40:25 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.54 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -39,6 +39,13 @@ #include "miscadmin.h" + +/* Max time to wait to acquire XLog activity locks */ +#define XLOG_LOCK_TIMEOUT (5*60*1000000) /* 5 minutes */ +/* Max time to wait to acquire checkpoint lock */ +#define CHECKPOINT_LOCK_TIMEOUT (10*60*1000000) /* 10 minutes */ + + int XLOGbuffers = 8; int XLOGfiles = 0; /* how many files to pre-allocate */ XLogRecPtr MyLastRecPtr = {0, 0}; @@ -178,8 +185,8 @@ typedef struct BkpBlock /* * We break each log file in 16Mb segments */ -#define XLogSegSize (16*1024*1024) -#define XLogLastSeg (0xffffffff / XLogSegSize) +#define XLogSegSize ((uint32) (16*1024*1024)) +#define XLogLastSeg (((uint32) 0xffffffff) / XLogSegSize) #define XLogFileSize (XLogLastSeg * XLogSegSize) #define NextLogSeg(_logId, _logSeg) \ @@ -423,7 +430,7 @@ begin:; } } } - S_LOCK_SLEEP(&(XLogCtl->insert_lck), i++); + S_LOCK_SLEEP(&(XLogCtl->insert_lck), i++, XLOG_LOCK_TIMEOUT); if (!TAS(&(XLogCtl->insert_lck))) break; } @@ -721,7 +728,7 @@ XLogFlush(XLogRecPtr record) break; } } - S_LOCK_SLEEP(&(XLogCtl->lgwr_lck), spins++); + S_LOCK_SLEEP(&(XLogCtl->lgwr_lck), spins++, XLOG_LOCK_TIMEOUT); } if (logFile >= 0 && (LgwrResult.Write.xlogid != logId || @@ -741,7 +748,7 @@ XLogFlush(XLogRecPtr record) logFile = XLogFileOpen(logId, logSeg, false); } - if (pg_fsync(logFile) != 0) + if (pg_fdatasync(logFile) != 0) elog(STOP, "fsync(logfile %u seg %u) failed: %m", logId, logSeg); LgwrResult.Flush = LgwrResult.Write; @@ -826,7 +833,7 @@ GetFreeXLBuffer() InitXLBuffer(curridx); return; } - S_LOCK_SLEEP(&(XLogCtl->lgwr_lck), spins++); + S_LOCK_SLEEP(&(XLogCtl->lgwr_lck), spins++, XLOG_LOCK_TIMEOUT); } } @@ -846,7 +853,7 @@ XLogWrite(char *buffer) { if (wcnt > 0) { - if (pg_fsync(logFile) != 0) + if (pg_fdatasync(logFile) != 0) elog(STOP, "fsync(logfile %u seg %u) failed: %m", logId, logSeg); if (LgwrResult.Write.xlogid != logId) @@ -928,7 +935,7 @@ XLogWrite(char *buffer) if (XLByteLT(LgwrResult.Flush, LgwrRqst.Flush) && XLByteLE(LgwrRqst.Flush, LgwrResult.Write)) { - if (pg_fsync(logFile) != 0) + if (pg_fdatasync(logFile) != 0) elog(STOP, "fsync(logfile %u seg %u) failed: %m", logId, logSeg); LgwrResult.Flush = LgwrResult.Write; @@ -948,13 +955,14 @@ XLogFileInit(uint32 log, uint32 seg, bool *usexistent) { char path[MAXPGPATH]; char tpath[MAXPGPATH]; + char zbuffer[BLCKSZ]; int fd; + int nbytes; XLogFileName(path, log, seg); /* - * Try to use existent file (checkpoint maker - * creates it sometime). + * Try to use existent file (checkpoint maker creates it sometimes). */ if (*usexistent) { @@ -963,7 +971,7 @@ XLogFileInit(uint32 log, uint32 seg, bool *usexistent) { if (errno != ENOENT) elog(STOP, "InitOpen(logfile %u seg %u) failed: %m", - logId, logSeg); + logId, logSeg); } else return(fd); @@ -979,33 +987,44 @@ XLogFileInit(uint32 log, uint32 seg, bool *usexistent) elog(STOP, "InitCreate(logfile %u seg %u) failed: %m", logId, logSeg); - if (lseek(fd, XLogSegSize - 1, SEEK_SET) != (off_t) (XLogSegSize - 1)) - elog(STOP, "lseek(logfile %u seg %u) failed: %m", - logId, logSeg); - - if (write(fd, "", 1) != 1) - elog(STOP, "write(logfile %u seg %u) failed: %m", - logId, logSeg); + /* + * Zero-fill the file. We have to do this the hard way to ensure that + * all the file space has really been allocated --- on platforms that + * allow "holes" in files, just seeking to the end doesn't allocate + * intermediate space. This way, we know that we have all the space + * and (after the fsync below) that all the indirect blocks are down + * on disk. Therefore, fdatasync(2) will be sufficient to sync future + * writes to the log file. + */ + MemSet(zbuffer, 0, sizeof(zbuffer)); + for (nbytes = 0; nbytes < XLogSegSize; nbytes += sizeof(zbuffer)) + { + if ((int) write(fd, zbuffer, sizeof(zbuffer)) != (int) sizeof(zbuffer)) + elog(STOP, "ZeroFill(logfile %u seg %u) failed: %m", + logId, logSeg); + } if (pg_fsync(fd) != 0) elog(STOP, "fsync(logfile %u seg %u) failed: %m", logId, logSeg); - if (lseek(fd, 0, SEEK_SET) < 0) - elog(STOP, "lseek(logfile %u seg %u off %u) failed: %m", - log, seg, 0); - close(fd); + /* + * Prefer link() to rename() here just to be sure that we don't overwrite + * an existing logfile. However, there shouldn't be one, so rename() + * is an acceptable substitute except for the truly paranoid. + */ #ifndef __BEOS__ if (link(tpath, path) < 0) + elog(STOP, "InitRelink(logfile %u seg %u) failed: %m", + logId, logSeg); + unlink(tpath); #else if (rename(tpath, path) < 0) -#endif elog(STOP, "InitRelink(logfile %u seg %u) failed: %m", logId, logSeg); - - unlink(tpath); +#endif fd = BasicOpenFile(path, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR); if (fd < 0) @@ -2101,7 +2120,8 @@ CreateCheckPoint(bool shutdown) /* Grab lock, using larger than normal sleep between tries (1 sec) */ while (TAS(&(XLogCtl->chkp_lck))) { - S_LOCK_SLEEP_INTERVAL(&(XLogCtl->chkp_lck), spins++, 1000000); + S_LOCK_SLEEP_INTERVAL(&(XLogCtl->chkp_lck), spins++, + CHECKPOINT_LOCK_TIMEOUT, 1000000); } memset(&checkPoint, 0, sizeof(checkPoint)); diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 6af9b4065d39f314d6ef9f8f8aa9d68f0f0e497c..5c5b6b8875c3ef46cfc2e0c22e73afb69f05ffa3 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.106 2001/01/24 19:43:05 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.107 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1990,6 +1990,9 @@ UnlockBuffers(void) } } +/* Max time to wait to acquire a buffer read or write lock */ +#define BUFFER_LOCK_TIMEOUT (10*60*1000000) /* 10 minutes */ + void LockBuffer(Buffer buffer, int mode) { @@ -2041,7 +2044,7 @@ LockBuffer(Buffer buffer, int mode) { S_UNLOCK(&(buf->cntx_lock)); RESUME_INTERRUPTS(); - S_LOCK_SLEEP(&(buf->cntx_lock), i++); + S_LOCK_SLEEP(&(buf->cntx_lock), i++, BUFFER_LOCK_TIMEOUT); HOLD_INTERRUPTS(); S_LOCK(&(buf->cntx_lock)); } @@ -2069,7 +2072,7 @@ LockBuffer(Buffer buffer, int mode) } S_UNLOCK(&(buf->cntx_lock)); RESUME_INTERRUPTS(); - S_LOCK_SLEEP(&(buf->cntx_lock), i++); + S_LOCK_SLEEP(&(buf->cntx_lock), i++, BUFFER_LOCK_TIMEOUT); HOLD_INTERRUPTS(); S_LOCK(&(buf->cntx_lock)); } diff --git a/src/backend/storage/buffer/s_lock.c b/src/backend/storage/buffer/s_lock.c index 3918bf0076701434e682384431b3850800ab3d18..ef70f45d887c8c58a0bc8fa4f2ae16ac14bbcc4d 100644 --- a/src/backend/storage/buffer/s_lock.c +++ b/src/backend/storage/buffer/s_lock.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.32 2001/01/24 19:43:06 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.33 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,23 +21,39 @@ #include "storage/s_lock.h" -/* +/*---------- * Each time we busy spin we select the next element of this array as the * number of microseconds to wait. This accomplishes pseudo random back-off. - * Values are not critical but 10 milliseconds is a common platform - * granularity. * - * Total time to cycle through all 20 entries might be about .07 sec, - * so the given value of S_MAX_BUSY results in timeout after ~70 sec. + * Note that on most platforms, specified values will be rounded up to the + * next multiple of a clock tick, which is often ten milliseconds (10000). + * So, we are being way overoptimistic to assume that these different values + * are really different, other than the last. But there are a few platforms + * with better-than-usual timekeeping, and on these we will get pretty good + * pseudo-random behavior. + * + * Total time to cycle through all 20 entries will be at least 100 msec, + * more commonly (10 msec resolution) 220 msec, and on some platforms + * as much as 420 msec (when the remainder of the current tick cycle is + * ignored in deciding when to time out, as on FreeBSD and older Linuxen). + * We use the 100msec figure to figure max_spins, so actual timeouts may + * be as much as four times the nominal value, but will never be less. + *---------- */ #define S_NSPINCYCLE 20 -#define S_MAX_BUSY 1000 * S_NSPINCYCLE int s_spincycle[S_NSPINCYCLE] = -{ 0, 0, 0, 0, 10000, 0, 0, 0, 10000, 0, - 0, 10000, 0, 0, 10000, 0, 10000, 0, 10000, 10000 +{ 1, 10, 100, 1000, + 10000, 1000, 1000, 1000, + 10000, 1000, 1000, 10000, + 1000, 1000, 10000, 1000, + 10000, 1000, 10000, 30000 }; +#define AVG_SPINCYCLE 5000 /* average entry in microsec: 100ms / 20 */ + +#define DEFAULT_TIMEOUT (100*1000000) /* default timeout: 100 sec */ + /* * s_lock_stuck() - complain about a stuck spinlock @@ -58,34 +74,40 @@ s_lock_stuck(volatile slock_t *lock, const char *file, const int line) /* * s_lock_sleep() - sleep a pseudo-random amount of time, check for timeout * - * Normally 'microsec' is 0, specifying to use the next s_spincycle[] value. + * The 'timeout' is given in microsec, or may be 0 for "infinity". Note that + * this will be a lower bound (a fairly loose lower bound, on most platforms). + * + * 'microsec' is the number of microsec to delay per loop. Normally + * 'microsec' is 0, specifying to use the next s_spincycle[] value. * Some callers may pass a nonzero interval, specifying to use exactly that * delay value rather than a pseudo-random delay. */ void -s_lock_sleep(unsigned spins, int microsec, +s_lock_sleep(unsigned spins, int timeout, int microsec, volatile slock_t *lock, const char *file, const int line) { struct timeval delay; - unsigned max_spins; if (microsec > 0) { delay.tv_sec = 0; delay.tv_usec = microsec; - /* two-minute timeout in this case */ - max_spins = 120000000 / microsec; } else { delay.tv_sec = 0; delay.tv_usec = s_spincycle[spins % S_NSPINCYCLE]; - max_spins = S_MAX_BUSY; + microsec = AVG_SPINCYCLE; /* use average to figure timeout */ } - if (spins > max_spins) - s_lock_stuck(lock, file, line); + if (timeout > 0) + { + unsigned max_spins = timeout / microsec; + + if (spins > max_spins) + s_lock_stuck(lock, file, line); + } (void) select(0, NULL, NULL, NULL, &delay); } @@ -110,7 +132,7 @@ s_lock(volatile slock_t *lock, const char *file, const int line) */ while (TAS(lock)) { - s_lock_sleep(spins++, 0, lock, file, line); + s_lock_sleep(spins++, DEFAULT_TIMEOUT, 0, lock, file, line); CHECK_FOR_INTERRUPTS(); } } diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 1feac25f4282a166c6d56200308ab0ca0d79173c..c6a72b8f25dc613b249e7aa7b3f9398f9bbc1faa 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.72 2001/02/17 01:00:04 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.73 2001/02/18 04:39:42 tgl Exp $ * * NOTES: * @@ -193,7 +193,7 @@ static char *filepath(char *filename); static long pg_nofile(void); /* - * pg_fsync --- same as fsync except does nothing if -F switch was given + * pg_fsync --- same as fsync except does nothing if enableFsync is off */ int pg_fsync(int fd) @@ -204,6 +204,26 @@ pg_fsync(int fd) return 0; } +/* + * pg_fdatasync --- same as fdatasync except does nothing if enableFsync is off + * + * Not all platforms have fdatasync; treat as fsync if not available. + */ +int +pg_fdatasync(int fd) +{ + if (enableFsync) + { +#ifdef HAVE_FDATASYNC + return fdatasync(fd); +#else + return fsync(fd); +#endif + } + else + return 0; +} + /* * BasicOpenFile --- same as open(2) except can free other FDs if needed * diff --git a/src/include/config.h.in b/src/include/config.h.in index 5c2dc088ef2b76756e3ed204358966cf62bdcb05..68e15d067b724996135013660329a1faeb2420a9 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -8,7 +8,7 @@ * or in config.h afterwards. Of course, if you edit config.h, then your * changes will be overwritten the next time you run configure. * - * $Id: config.h.in,v 1.157 2001/01/22 23:28:52 tgl Exp $ + * $Id: config.h.in,v 1.158 2001/02/18 04:39:42 tgl Exp $ */ #ifndef CONFIG_H @@ -548,6 +548,19 @@ extern void srandom(unsigned int seed); */ #define MAX_RANDOM_VALUE (0x7FFFFFFF) +/* Define if you have dlopen() */ +#undef HAVE_DLOPEN + +/* Define if you have fdatasync() */ +#undef HAVE_FDATASYNC + +/* Define if the standard header unistd.h declares fdatasync() */ +#undef HAVE_FDATASYNC_DECL + +#if defined(HAVE_FDATASYNC) && !defined(HAVE_FDATASYNC_DECL) +extern int fdatasync(int fildes); +#endif + /* Set to 1 if you have libz.a */ #undef HAVE_LIBZ @@ -611,9 +624,6 @@ extern void srandom(unsigned int seed); /* Define if C++ compiler accepts "#include <string>" */ #undef HAVE_CXX_STRING_HEADER -/* Define if you have dlopen() */ -#undef HAVE_DLOPEN - /* Define if you have the optreset variable */ #undef HAVE_INT_OPTRESET diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index fb8486b0758a6b31097ab7070a169785aac80bcc..46ec1fdb94442adcb37ad0f58fb58360b28cd147 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: fd.h,v 1.26 2001/01/24 19:43:27 momjian Exp $ + * $Id: fd.h,v 1.27 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -71,5 +71,6 @@ extern int BasicOpenFile(FileName fileName, int fileFlags, int fileMode); extern void closeAllVfds(void); extern void AtEOXact_Files(void); extern int pg_fsync(int fd); +extern int pg_fdatasync(int fd); #endif /* FD_H */ diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 9cf73163d60779526a83f3ed31c472e20275d027..5e3a15524b4966f060700a93a4830b4efffe73f7 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.89 2001/02/16 23:50:40 tgl Exp $ + * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.90 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -48,11 +48,12 @@ * unsigned spins = 0; * * while (TAS(lock)) - * S_LOCK_SLEEP(lock, spins++); + * S_LOCK_SLEEP(lock, spins++, timeout); * } * * where S_LOCK_SLEEP() checks for timeout and sleeps for a short - * interval. Callers that want to perform useful work while waiting + * interval. (The timeout is expressed in microseconds, or can be 0 for + * "infinity".) Callers that want to perform useful work while waiting * can write out this entire loop and insert the "useful work" inside * the loop. * @@ -86,7 +87,7 @@ /* Platform-independent out-of-line support routines */ extern void s_lock(volatile slock_t *lock, const char *file, const int line); -extern void s_lock_sleep(unsigned spins, int microsec, +extern void s_lock_sleep(unsigned spins, int timeout, int microsec, volatile slock_t *lock, const char *file, const int line); @@ -518,13 +519,13 @@ extern int tas_sema(volatile slock_t *lock); #endif /* S_LOCK */ #if !defined(S_LOCK_SLEEP) -#define S_LOCK_SLEEP(lock,spins) \ - s_lock_sleep((spins), 0, (lock), __FILE__, __LINE__) +#define S_LOCK_SLEEP(lock,spins,timeout) \ + s_lock_sleep((spins), (timeout), 0, (lock), __FILE__, __LINE__) #endif /* S_LOCK_SLEEP */ #if !defined(S_LOCK_SLEEP_INTERVAL) -#define S_LOCK_SLEEP_INTERVAL(lock,spins,microsec) \ - s_lock_sleep((spins), (microsec), (lock), __FILE__, __LINE__) +#define S_LOCK_SLEEP_INTERVAL(lock,spins,timeout,microsec) \ + s_lock_sleep((spins), (timeout), (microsec), (lock), __FILE__, __LINE__) #endif /* S_LOCK_SLEEP_INTERVAL */ #if !defined(S_LOCK_FREE)