Changeset 942
- Timestamp:
- 06/14/07 21:07:09 (1 year ago)
- Files:
-
- 1.8.3/branches/experimental/config.h.in (modified) (2 diffs)
- 1.8.3/branches/experimental/configure (modified) (6 diffs)
- 1.8.3/branches/experimental/configure.in (modified) (3 diffs)
- 1.8.3/branches/experimental/game/restart (modified) (1 diff)
- 1.8.3/branches/experimental/hdrs/game.h (modified) (1 diff)
- 1.8.3/branches/experimental/hdrs/help.h (modified) (1 diff)
- 1.8.3/branches/experimental/src/command.c (modified) (1 diff)
- 1.8.3/branches/experimental/src/csrimalloc.c (modified) (2 diffs)
- 1.8.3/branches/experimental/src/help.c (modified) (11 diffs)
- 1.8.3/branches/experimental/src/htmltab.c (modified) (2 diffs)
- 1.8.3/branches/experimental/src/lmath.c (modified) (4 diffs)
- 1.8.3/branches/experimental/src/wiz.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.8.3/branches/experimental/config.h.in
r897 r942 33 33 #undef I_SYS_IN 34 34 35 #undef I_SYS_MMAN35 #undef HAVE_SYS_MMAN_H 36 36 37 37 #undef I_SYS_PAGE … … 273 273 #undef HAVE_KQUEUE 274 274 275 #undef HAVE_MMAP 276 277 #undef HAVE_POSIX_MADVISE 278 279 #undef HAVE_MADVISE 280 281 #undef HAVE_PWRITE 282 275 283 /* Variables and defines */ 276 284 1.8.3/branches/experimental/configure
r922 r942 6854 6854 6855 6855 6856 if test "${ac_cv_header_sys_mman_h+set}" = set; then6857 { echo "$as_me:$LINENO: checking for sys/mman.h" >&56858 echo $ECHO_N "checking for sys/mman.h... $ECHO_C" >&6; }6859 if test "${ac_cv_header_sys_mman_h+set}" = set; then6860 echo $ECHO_N "(cached) $ECHO_C" >&66861 fi6862 { echo "$as_me:$LINENO: result: $ac_cv_header_sys_mman_h" >&56863 echo "${ECHO_T}$ac_cv_header_sys_mman_h" >&6; }6864 else6865 # Is the header compilable?6866 { echo "$as_me:$LINENO: checking sys/mman.h usability" >&56867 echo $ECHO_N "checking sys/mman.h usability... $ECHO_C" >&6; }6868 cat >conftest.$ac_ext <<_ACEOF6869 /* confdefs.h. */6870 _ACEOF6871 cat confdefs.h >>conftest.$ac_ext6872 cat >>conftest.$ac_ext <<_ACEOF6873 /* end confdefs.h. */6874 $ac_includes_default6875 #include <sys/mman.h>6876 _ACEOF6877 rm -f conftest.$ac_objext6878 if { (ac_try="$ac_compile"6879 case "(($ac_try" in6880 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;6881 *) ac_try_echo=$ac_try;;6882 esac6883 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&56884 (eval "$ac_compile") 2>conftest.er16885 ac_status=$?6886 grep -v '^ *+' conftest.er1 >conftest.err6887 rm -f conftest.er16888 cat conftest.err >&56889 echo "$as_me:$LINENO: \$? = $ac_status" >&56890 (exit $ac_status); } &&6891 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'6892 { (case "(($ac_try" in6893 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;6894 *) ac_try_echo=$ac_try;;6895 esac6896 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&56897 (eval "$ac_try") 2>&56898 ac_status=$?6899 echo "$as_me:$LINENO: \$? = $ac_status" >&56900 (exit $ac_status); }; } &&6901 { ac_try='test -s conftest.$ac_objext'6902 { (case "(($ac_try" in6903 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;6904 *) ac_try_echo=$ac_try;;6905 esac6906 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&56907 (eval "$ac_try") 2>&56908 ac_status=$?6909 echo "$as_me:$LINENO: \$? = $ac_status" >&56910 (exit $ac_status); }; }; then6911 ac_header_compiler=yes6912 else6913 echo "$as_me: failed program was:" >&56914 sed 's/^/| /' conftest.$ac_ext >&56915 6916 ac_header_compiler=no6917 fi6918 6919 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext6920 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&56921 echo "${ECHO_T}$ac_header_compiler" >&6; }6922 6923 # Is the header present?6924 { echo "$as_me:$LINENO: checking sys/mman.h presence" >&56925 echo $ECHO_N "checking sys/mman.h presence... $ECHO_C" >&6; }6926 cat >conftest.$ac_ext <<_ACEOF6927 /* confdefs.h. */6928 _ACEOF6929 cat confdefs.h >>conftest.$ac_ext6930 cat >>conftest.$ac_ext <<_ACEOF6931 /* end confdefs.h. */6932 #include <sys/mman.h>6933 _ACEOF6934 if { (ac_try="$ac_cpp conftest.$ac_ext"6935 case "(($ac_try" in6936 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;6937 *) ac_try_echo=$ac_try;;6938 esac6939 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&56940 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er16941 ac_status=$?6942 grep -v '^ *+' conftest.er1 >conftest.err6943 rm -f conftest.er16944 cat conftest.err >&56945 echo "$as_me:$LINENO: \$? = $ac_status" >&56946 (exit $ac_status); } >/dev/null; then6947 if test -s conftest.err; then6948 ac_cpp_err=$ac_c_preproc_warn_flag6949 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag6950 else6951 ac_cpp_err=6952 fi6953 else6954 ac_cpp_err=yes6955 fi6956 if test -z "$ac_cpp_err"; then6957 ac_header_preproc=yes6958 else6959 echo "$as_me: failed program was:" >&56960 sed 's/^/| /' conftest.$ac_ext >&56961 6962 ac_header_preproc=no6963 fi6964 6965 rm -f conftest.err conftest.$ac_ext6966 { echo "$as_me:$LINENO: result: $ac_header_preproc" >&56967 echo "${ECHO_T}$ac_header_preproc" >&6; }6968 6969 # So? What about this header?6970 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in6971 yes:no: )6972 { echo "$as_me:$LINENO: WARNING: sys/mman.h: accepted by the compiler, rejected by the preprocessor!" >&56973 echo "$as_me: WARNING: sys/mman.h: accepted by the compiler, rejected by the preprocessor!" >&2;}6974 { echo "$as_me:$LINENO: WARNING: sys/mman.h: proceeding with the compiler's result" >&56975 echo "$as_me: WARNING: sys/mman.h: proceeding with the compiler's result" >&2;}6976 ac_header_preproc=yes6977 ;;6978 no:yes:* )6979 { echo "$as_me:$LINENO: WARNING: sys/mman.h: present but cannot be compiled" >&56980 echo "$as_me: WARNING: sys/mman.h: present but cannot be compiled" >&2;}6981 { echo "$as_me:$LINENO: WARNING: sys/mman.h: check for missing prerequisite headers?" >&56982 echo "$as_me: WARNING: sys/mman.h: check for missing prerequisite headers?" >&2;}6983 { echo "$as_me:$LINENO: WARNING: sys/mman.h: see the Autoconf documentation" >&56984 echo "$as_me: WARNING: sys/mman.h: see the Autoconf documentation" >&2;}6985 { echo "$as_me:$LINENO: WARNING: sys/mman.h: section \"Present But Cannot Be Compiled\"" >&56986 echo "$as_me: WARNING: sys/mman.h: section \"Present But Cannot Be Compiled\"" >&2;}6987 { echo "$as_me:$LINENO: WARNING: sys/mman.h: proceeding with the preprocessor's result" >&56988 echo "$as_me: WARNING: sys/mman.h: proceeding with the preprocessor's result" >&2;}6989 { echo "$as_me:$LINENO: WARNING: sys/mman.h: in the future, the compiler will take precedence" >&56990 echo "$as_me: WARNING: sys/mman.h: in the future, the compiler will take precedence" >&2;}6991 6992 ;;6993 esac6994 { echo "$as_me:$LINENO: checking for sys/mman.h" >&56995 echo $ECHO_N "checking for sys/mman.h... $ECHO_C" >&6; }6996 if test "${ac_cv_header_sys_mman_h+set}" = set; then6997 echo $ECHO_N "(cached) $ECHO_C" >&66998 else6999 ac_cv_header_sys_mman_h=$ac_header_preproc7000 fi7001 { echo "$as_me:$LINENO: result: $ac_cv_header_sys_mman_h" >&57002 echo "${ECHO_T}$ac_cv_header_sys_mman_h" >&6; }7003 7004 fi7005 if test $ac_cv_header_sys_mman_h = yes; then7006 cat >>confdefs.h <<\_ACEOF7007 #define I_SYS_MMAN 17008 _ACEOF7009 7010 fi7011 7012 7013 6856 if test "${ac_cv_header_sys_page_h+set}" = set; then 7014 6857 { echo "$as_me:$LINENO: checking for sys/page.h" >&5 … … 7800 7643 7801 7644 7802 for ac_header in sys/un.h ieeefp.h sys/resource.h sys/event.h 7645 7646 for ac_header in sys/mman.h sys/un.h ieeefp.h sys/resource.h sys/event.h 7803 7647 do 7804 7648 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` … … 16244 16088 16245 16089 16246 for ac_func in snprintf vsnprintf 16090 16091 for ac_func in mmap madvise posix_madvise pwrite 16247 16092 do 16248 16093 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` … … 16353 16198 done 16354 16199 16200 16201 16202 16203 for ac_func in snprintf vsnprintf 16204 do 16205 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` 16206 { echo "$as_me:$LINENO: checking for $ac_func" >&5 16207 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } 16208 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then 16209 echo $ECHO_N "(cached) $ECHO_C" >&6 16210 else 16211 cat >conftest.$ac_ext <<_ACEOF 16212 /* confdefs.h. */ 16213 _ACEOF 16214 cat confdefs.h >>conftest.$ac_ext 16215 cat >>conftest.$ac_ext <<_ACEOF 16216 /* end confdefs.h. */ 16217 /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. 16218 For example, HP-UX 11i <limits.h> declares gettimeofday. */ 16219 #define $ac_func innocuous_$ac_func 16220 16221 /* System header to define __stub macros and hopefully few prototypes, 16222 which can conflict with char $ac_func (); below. 16223 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since 16224 <limits.h> exists even on freestanding compilers. */ 16225 16226 #ifdef __STDC__ 16227 # include <limits.h> 16228 #else 16229 # include <assert.h> 16230 #endif 16231 16232 #undef $ac_func 16233 16234 /* Override any GCC internal prototype to avoid an error. 16235 Use char because int might match the return type of a GCC 16236 builtin and then its argument prototype would still apply. */ 16237 #ifdef __cplusplus 16238 extern "C" 16239 #endif 16240 char $ac_func (); 16241 /* The GNU C library defines this for functions which it implements 16242 to always fail with ENOSYS. Some functions are actually named 16243 something starting with __ and the normal name is an alias. */ 16244 #if defined __stub_$ac_func || defined __stub___$ac_func 16245 choke me 16246 #endif 16247 16248 int 16249 main () 16250 { 16251 return $ac_func (); 16252 ; 16253 return 0; 16254 } 16255 _ACEOF 16256 rm -f conftest.$ac_objext conftest$ac_exeext 16257 if { (ac_try="$ac_link" 16258 case "(($ac_try" in 16259 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 16260 *) ac_try_echo=$ac_try;; 16261 esac 16262 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 16263 (eval "$ac_link") 2>conftest.er1 16264 ac_status=$? 16265 grep -v '^ *+' conftest.er1 >conftest.err 16266 rm -f conftest.er1 16267 cat conftest.err >&5 16268 echo "$as_me:$LINENO: \$? = $ac_status" >&5 16269 (exit $ac_status); } && 16270 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' 16271 { (case "(($ac_try" in 16272 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 16273 *) ac_try_echo=$ac_try;; 16274 esac 16275 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 16276 (eval "$ac_try") 2>&5 16277 ac_status=$? 16278 echo "$as_me:$LINENO: \$? = $ac_status" >&5 16279 (exit $ac_status); }; } && 16280 { ac_try='test -s conftest$ac_exeext' 16281 { (case "(($ac_try" in 16282 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 16283 *) ac_try_echo=$ac_try;; 16284 esac 16285 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 16286 (eval "$ac_try") 2>&5 16287 ac_status=$? 16288 echo "$as_me:$LINENO: \$? = $ac_status" >&5 16289 (exit $ac_status); }; }; then 16290 eval "$as_ac_var=yes" 16291 else 16292 echo "$as_me: failed program was:" >&5 16293 sed 's/^/| /' conftest.$ac_ext >&5 16294 16295 eval "$as_ac_var=no" 16296 fi 16297 16298 rm -f core conftest.err conftest.$ac_objext \ 16299 conftest$ac_exeext conftest.$ac_ext 16300 fi 16301 ac_res=`eval echo '${'$as_ac_var'}'` 16302 { echo "$as_me:$LINENO: result: $ac_res" >&5 16303 echo "${ECHO_T}$ac_res" >&6; } 16304 if test `eval echo '${'$as_ac_var'}'` = yes; then 16305 cat >>confdefs.h <<_ACEOF 16306 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 16307 _ACEOF 16308 16309 fi 16310 done 16311 16355 16312 { echo "$as_me:$LINENO: checking for working snprintf" >&5 16356 16313 echo $ECHO_N "checking for working snprintf... $ECHO_C" >&6; } … … 17976 17933 ac_config_files="$ac_config_files Makefile src/Makefile" 17977 17934 17978 ac_config_files="$ac_config_files utils/mkcmds.sh game/txt/compose.sh" 17935 ac_config_files="$ac_config_files utils/mkcmds.sh" 17936 17937 ac_config_files="$ac_config_files game/txt/compose.sh" 17979 17938 17980 17939 cat >confcache <<\_ACEOF … … 19068 19027 19069 19028 case $ac_file$ac_mode in 19070 "utils/mkcmds.sh":F) chmod +x utils/mkcmds.sh game/txt/compose.sh;;19071 "game/txt/compose.sh":F) chmod +x utils/mkcmds.shgame/txt/compose.sh ;;19029 "utils/mkcmds.sh":F) chmod +x utils/mkcmds.sh ;; 19030 "game/txt/compose.sh":F) chmod +x game/txt/compose.sh ;; 19072 19031 19073 19032 esac 1.8.3/branches/experimental/configure.in
r922 r942 99 99 AC_CHECK_HEADER(sys/file.h, [AC_DEFINE(I_SYS_FILE)]) 100 100 AC_CHECK_HEADER(sys/in.h, [AC_DEFINE(I_SYS_IN)]) 101 AC_CHECK_HEADER(sys/mman.h, [AC_DEFINE(I_SYS_MMAN)])102 101 AC_CHECK_HEADER(sys/page.h, [AC_DEFINE(I_SYS_PAGE)]) 103 102 AC_CHECK_HEADER(sys/param.h, [AC_DEFINE(I_SYS_PARAM)]) … … 105 104 AC_CHECK_HEADER(sys/stat.h, [AC_DEFINE(I_SYS_STAT)]) 106 105 AC_CHECK_HEADER(sys/types.h, [AC_DEFINE(I_SYS_TYPES)]) 107 AC_CHECK_HEADERS([sys/ un.h ieeefp.h sys/resource.h sys/event.h])106 AC_CHECK_HEADERS([sys/mman.h sys/un.h ieeefp.h sys/resource.h sys/event.h]) 108 107 109 108 ### C language support … … 182 181 AC_CHECK_FUNCS([cbrt getuid geteuid seteuid getpriority setpriority socketpair]) 183 182 AC_CHECK_FUNCS([sigaction sigprocmask imaxdiv kqueue]) 183 AC_CHECK_FUNCS([mmap madvise posix_madvise pwrite]) 184 184 185 185 AC_FUNC_SNPRINTF 1.8.3/branches/experimental/game/restart
r694 r942 115 115 mv -f log/*.log save/ 116 116 117 # And delete old mmap files 118 rm -f data/*.map 119 117 120 if [ -r "data/$OUTDB$SUFFIX" ]; then 118 121 rm -f save/$INDB$SUFFIX.old 1.8.3/branches/experimental/hdrs/game.h
r922 r942 14 14 15 15 /* hash table stuff */ 16 extern void init_func_hashtab(void); /* eval.c */17 extern void init_aname_table(void); /* atr_tab.c */18 extern void init_flagspaces(void); /* flags.c */19 extern void init_flag_table(const char *ns); /* flags.c */20 extern void init_pronouns(void); /* funstr.c */21 void init_switches(void); /* command.c */16 extern void init_func_hashtab(void); /* eval.c */ 17 extern void init_aname_table(void); /* atr_tab.c */ 18 extern void init_flagspaces(void); /* flags.c */ 19 extern void init_flag_table(const char *ns); /* flags.c */ 20 extern void init_pronouns(void); /* funstr.c */ 21 void init_switches(void); /* command.c */ 22 22 23 23 /* From bsd.c */ 1.8.3/branches/experimental/hdrs/help.h
r922 r942 24 24 int admin; /**< Is this an admin-only help command? */ 25 25 help_indx *indx; /**< An array of help index entries */ 26 int index_fd; /**< File descripted of a mmaped index */ 26 27 size_t entries; /**< Number of entries in the help file */ 27 28 } help_file; 28 29 29 30 30 externvoid init_help_files(void);31 extern void add_help_file 32 (const char *command_name, const char *filename, int admin);33 extern void help_reindex(dbref player);31 void init_help_files(void); 32 void add_help_file(const char *command_name, const char *filename, int admin); 33 void help_reindex(dbref player); 34 void free_help_indexes(void); 34 35 #endif /* __HELP_H */ 1.8.3/branches/experimental/src/command.c
r922 r942 504 504 ptab_start_inserts(&ptab_command); 505 505 ptab_insert(&ptab_command, name, 506 make_command(name, type, flagmask, powers, sw, func));506 make_command(name, type, flagmask, powers, sw, func)); 507 507 ptab_end_inserts(&ptab_command); 508 508 return command_find(name); 1.8.3/branches/experimental/src/csrimalloc.c
r922 r942 11 11 #include <sys/file.h> 12 12 #endif 13 #ifdef I_SYS_MMAN13 #ifdef HAVE_SYS_MMAN_H 14 14 #include <sys/mman.h> 15 15 #endif … … 970 970 #ifdef CSRI_TRACE 971 971 /* Tracing malloc definitions - helps find leaks */ 972 univptr_t trace__malloc 973 _((size_t nbytes, const char *fname, int linenum)); 974 univptr_t trace__calloc 975 _((size_t nelem, size_t elsize, const char *fname, int linenum)); 976 univptr_t trace__realloc 977 _((univptr_t cp, size_t nbytes, const char *fname, int linenum)); 978 univptr_t trace__valloc _((size_t size, const char *fname, int linenum)); 979 univptr_t trace__memalign 980 _((size_t alignment, size_t size, const char *fname, int linenum)); 981 univptr_t trace__emalloc _((size_t nbytes, const char *fname, int linenum)); 972 univptr_t 973 trace__malloc 974 _((size_t nbytes, const char *fname, int linenum)); 975 univptr_t 976 trace__calloc 977 _((size_t nelem, size_t elsize, const char *fname, int linenum)); 978 univptr_t 979 trace__realloc 980 _((univptr_t cp, size_t nbytes, const char *fname, int linenum)); 981 univptr_t trace__valloc 982 _((size_t size, const char *fname, int linenum)); 983 univptr_t 984 trace__memalign 985 _((size_t alignment, size_t size, const char *fname, int linenum)); 986 univptr_t trace__emalloc 987 _((size_t nbytes, const char *fname, int linenum)); 982 988 univptr_t 983 989 trace__ecalloc _((size_t nelem, size_t sz, const char *fname, int linenum)); 990 univptr_t trace__erealloc 991 _((univptr_t ptr, size_t nbytes, const char *fname, int linenum)); 992 char *trace__strdup _((const char *s, const char *fname, int linenum)); 993 char *trace__strsave _((const char *s, const char *fname, int linenum)); 994 void 995 trace__free _((univptr_t cp, const char *fname, int linenum)); 996 void 997 trace__cfree _((univptr_t cp, const char *fname, int linenum)); 998 #else /* CSRI_TRACE */ 984 999 univptr_t 985 trace__erealloc 986 _((univptr_t ptr, size_t nbytes, const char *fname, int linenum)); 987 char * 988 trace__strdup 989 _((const char *s, const char *fname, int linenum)); 990 char * 991 trace__strsave 992 _((const char *s, const char *fname, int linenum)); 1000 malloc 1001 _((size_t nbytes)); 1002 univptr_t 1003 calloc 1004 _((size_t nelem, size_t elsize)); 1005 univptr_t 1006 realloc 1007 _((univptr_t cp, size_t nbytes)); 1008 univptr_t 1009 valloc 1010 _((size_t size)); 1011 univptr_t 1012 memalign 1013 _((size_t alignment, size_t size)); 1014 univptr_t 1015 emalloc 1016 _((size_t nbytes)); 1017 univptr_t 1018 ecalloc 1019 _((size_t nelem, size_t sz)); 1020 univptr_t 1021 erealloc 1022 _((univptr_t ptr, size_t nbytes)); 1023 Free_t free 1024 _((univptr_t cp)); 1025 Free_t cfree 1026 _((univptr_t cp)); 1027 #endif /* CSRI_TRACE */ 1028 1029 int 1030 __m_botch 1031 _((const char *s1, const char *s2, univptr_t p, 1032 int is_end_ptr, const char *filename, int linenumber)); 993 1033 void 994 trace__free995 _(( univptr_t cp, const char *fname, int linenum));1034 __m_prnode 1035 _((SPBLK * spblk)); 996 1036 void 997 trace__cfree 998 _((univptr_t cp, const char *fname, int linenum)); 999 #else /* CSRI_TRACE */ 1000 univptr_t malloc 1001 _((size_t nbytes)); 1002 univptr_t calloc 1003 _((size_t nelem, size_t elsize)); 1004 univptr_t realloc 1005 _((univptr_t cp, size_t nbytes)); 1006 univptr_t valloc 1007 _((size_t size)); 1008 univptr_t memalign 1009 _((size_t alignment, size_t size)); 1010 univptr_t emalloc 1011 _((size_t nbytes)); 1012 univptr_t ecalloc 1013 _((size_t nelem, size_t sz)); 1014 univptr_t erealloc 1015 _((univptr_t ptr, size_t nbytes)); 1016 Free_t free _((univptr_t cp)); 1017 Free_t cfree _((univptr_t cp)); 1018 #endif /* CSRI_TRACE */ 1019 1020 int 1021 __m_botch 1022 _((const char *s1, const char *s2, univptr_t p, 1023 int is_end_ptr, const char *filename, int linenumber)); 1024 void 1025 __m_prnode _((SPBLK * spblk)); 1026 void 1027 mal_contents _((FILE * fp)); 1037 mal_contents 1038 _((FILE * fp)); 1028 1039 #ifdef CSRI_DEBUG 1029 1040 void 1030 mal_debug _((int level)); 1041 mal_debug 1042 _((int level)); 1031 1043 int 1032 mal_verify _((int fullcheck)); 1044 mal_verify 1045 _((int fullcheck)); 1033 1046 #endif 1034 1047 void 1035 mal_dumpleaktrace _((FILE * fp)); 1048 mal_dumpleaktrace 1049 _((FILE * fp)); 1036 1050 void 1037 mal_heapdump _((FILE * fp)); 1051 mal_heapdump 1052 _((FILE * fp)); 1038 1053 void 1039 mal_leaktrace _((int value)); 1054 mal_leaktrace 1055 _((int value)); 1040 1056 void 1041 mal_sbrkset _((int n)); 1057 mal_sbrkset 1058 _((int n)); 1042 1059 void 1043 mal_slopset _((int n)); 1060 mal_slopset 1061 _((int n)); 1044 1062 #ifdef CSRI_PROFILESIZES 1045 1063 void 1046 mal_statsdump _((FILE * fp)); 1064 mal_statsdump 1065 _((FILE * fp)); 1047 1066 #endif 1048 1067 void 1049 mal_trace _((int value)); 1068 mal_trace 1069 _((int value)); 1050 1070 void 1051 mal_mmap _((char *fname)); 1071 mal_mmap 1072 _((char *fname)); 1052 1073 1053 1074 #ifdef CSRI_TRACE 1.8.3/branches/experimental/src/help.c
r922 r942 11 11 #include <ctype.h> 12 12 #include <stdio.h> 13 #ifdef I_SYS_TYPES 14 #include <sys/types.h> 15 #endif 16 #ifdef HAVE_SYS_MMAN_H 17 #include <sys/mman.h> 18 #endif 19 #ifdef I_FCNTL 20 #include <fcntl.h> 21 #endif 22 #ifdef I_UNISTD 23 #include <unistd.h> 24 #endif 13 25 #include "conf.h" 14 26 #include "externs.h" … … 140 152 help_file *curr; 141 153 142 for (curr = (help_file *) hash_firstentry(&help_files); 143 curr; curr = (help_file *) hash_nextentry(&help_files)) { 154 for (curr = hash_firstentry(&help_files); 155 curr; curr = hash_nextentry(&help_files)) { 156 #ifdef HAVE_MMAP 157 if (curr->index_fd > 0) { 158 munmap(curr->indx, curr->entries * sizeof(help_indx)); 159 curr->entries = 0; 160 } else 161 #endif 144 162 if (curr->indx) { 145 mush_free( (Malloc_t)curr->indx, "help_index");163 mush_free(curr->indx, "help_index"); 146 164 curr->entries = 0; 147 165 } … … 301 319 nextptr = cur->next; 302 320 if (num_topics >= top_topics) { 303 top_topics += top_topics / 2 + 20; 304 if (topics) 305 topics = (help_indx *) realloc(topics, top_topics * sizeof(help_indx)); 306 else 307 topics = (help_indx *) malloc(top_topics * sizeof(help_indx)); 308 if (!topics) { 309 mush_panic(T("Out of memory")); 310 } 321 /* Never happen! */ 322 mush_panic(T("Out of memory")); 311 323 } 312 324 temp = &topics[num_topics++]; 313 325 temp->pos = p; 314 326 strcpy(temp->topic, cur->topic); 315 free(cur);327 mush_free(cur, "tlist"); 316 328 } 317 329 top = NULL; … … 341 353 FILE *rfp; 342 354 tlist *cur; 355 size_t index_size = 0; 343 356 344 357 /* Quietly ignore null values for the file */ … … 363 376 in_topic = 0; 364 377 378 /* Go through and count the topics so we know how much space to allocate. 379 * Print out warning messages here too. */ 365 380 while (fgets(line, LINE_SIZE, rfp) != NULL) { 366 381 ++lineno; 367 if ( ntopics == 0) {382 if (!in_topic) { 368 383 /* Looking for the first topic, but we'll ignore blank lines */ 369 384 if (!line[0]) { … … 388 403 } 389 404 if (line[0] == '&') { 405 unsigned char *c = (unsigned char *) line + 1; 406 in_topic = true; 407 while (*c && isspace(*c)) 408 c++; 409 if (*c == '&' && restricted) 410 ++ntopics; 411 else if (*c != '&' && !restricted) 412 ++ntopics; 413 } 414 } 415 416 topics = NULL; 417 index_size = (ntopics + 1) * sizeof(help_indx); 418 419 #ifdef HAVE_MMAP 420 do { 421 uint8_t x; 422 423 /* First we have to create a new file and make it large enough 424 to hold the index. Do this by seeking to the end and writing 425 a byte to make a sparse file. */ 426 427 h->index_fd = open(tprintf("%s/help_%s.%d.map", "data", h->command, 428 getpid()), O_RDWR | O_CREAT | O_TRUNC, 0600); 429 if (h->index_fd < 0) { 430 perror("opening index file for mapping"); 431 h->indx = topics; 432 break; 433 } 434 435 x = '\xFF'; 436 437 #ifdef HAVE_PWRITE 438 if (pwrite(h->index_fd, &x, 1, index_size + 1) < 0) { 439 perror("pwrite: writing byte at end of index file"); 440 close(h->index_fd); 441 h->index_fd = -1; 442 h->indx = topics; 443 break; 444 } 445 #else 446 if (lseek(h->index_fd, index_size + 1, SEEK_SET) < 0) { 447 perror("seeking to end of index file"); 448 close(h->index_fd); 449 h->index_fd = -1; 450 h->indx = topics; 451 break; 452 } 453 454 x = '\xFF'; 455 if (write(h->index_fd, &x, 1) < 0) { 456 perror("write: writing byte at end of index file"); 457 close(h->index_fd); 458 h->index_fd = -1; 459 h->indx = topics; 460 break; 461 } 462 lseek(h->index_fd, 0, SEEK_SET); 463 #endif 464 465 h->indx = mmap(NULL, index_size, PROT_READ | PROT_WRITE, 466 MAP_FILE | MAP_SHARED, h->index_fd, 0); 467 468 if ((caddr_t) h->indx == (caddr_t) - 1) { 469 perror("mapping file"); 470 close(h->index_fd); 471 h->index_fd = -1; 472 h->indx = topics; 473 break; 474 } 475 476 close(h->index_fd); 477 topics = h->indx; 478 add_check("help_index"); 479 } while (0); 480 #endif /* MMAP */ 481 if (!topics) { 482 h->indx = topics = calloc(ntopics + 1, sizeof(help_indx)); 483 add_check("help_index"); 484 } 485 #ifdef HAVE_POSIX_MADVISE 486 if (posix_madvise(h->indx, index_size, POSIX_MADV_SEQUENTIAL) < 0) 487 perror("posix_madvise(POSIX_MADV_SEQUENTIAL"); 488 #elif defined(HAVE_MADVISE) 489 if (madvise(h->indx, index_size, MADV_SEQUENTIAL) < 0) 490 perror("madvise(MADV_SEQUENTIAL"); 491 #endif 492 493 top_topics = ntopics + 1; 494 495 /* Rewind */ 496 fseek(rfp, 0, SEEK_SET); 497 ntopics = 0; 498 lineno = 0; 499 500 while (fgets(line, LINE_SIZE, rfp) != NULL) { 501 ++lineno; 502 503 /* Skip leading lines without a & */ 504 if (ntopics == 0 && line[0] != '&') 505 continue; 506 507 n = strlen(line); 508 509 if (line[0] == '&') { 390 510 ++ntopics; 391 511 if (!in_topic) { … … 396 516 in_topic = true; 397 517 } 518 398 519 /* parse out the topic */ 399 520 /* Get the beginning of the topic string */ … … 402 523 403 524 /* Get the topic */ 404 strcpy(the_topic, "");525 the_topic[0] = '\0'; 405 526 for (i = -1, s = topic; *s != '\n' && *s != '\0'; s++) { 406 527 if (i >= TOPIC_NAME_LEN - 1) … … 412 533 || (!restricted && the_topic[0] != '&')) { 413 534 the_topic[++i] = '\0'; 414 cur = (tlist *) malloc(sizeof(tlist));535 cur = mush_malloc(sizeof(tlist), "tlist"); 415 536 strcpy(cur->topic, the_topic); 416 537 cur->next = top; … … 425 546 bigpos = ftell(rfp); 426 547 } 427 428 548 /* Handle last topic */ 429 549 write_topic(pos); 550 #ifdef HAVE_POSIX_MADVISE 551 if (posix_madvise(h->indx, index_size, POSIX_MADV_RANDOM) < 0) 552 perror("posix_madvise(POSIX_MADV_RANDOM)"); 553 #elif defined(HAVE_MADVISE) 554 if (madvise(h->indx, index_size, MADV_RANDOM) < 0) 555 perror("madvise(MADV_RANDOM)"); 556 #endif 430 557 qsort(topics, num_topics, sizeof(help_indx), topic_cmp); 431 558 h->entries = num_topics; 432 h->indx = topics;433 add_check("help_index"); 559 topics = NULL; 560 434 561 fclose(rfp); 435 562 do_rawlog(LT_WIZ, T("%d topics indexed."), num_topics); … … 589 716 return buff; 590 717 } 718 719 /** Unmaps all help indexes. Used before a reboot */ 720 void 721 free_help_indexes(void) 722 { 723 #ifdef HAVE_MMAP 724 help_file *curr; 725 726 for (curr = hash_firstentry(&help_files); 727 curr; curr = hash_nextentry(&help_files)) { 728 if (curr->index_fd > 0) { 729 munmap(curr->indx, curr->entries * sizeof(help_indx)); 730 curr->entries = 0; 731 } 732 } 733 #endif 734 } 1.8.3/branches/experimental/src/htmltab.c
r897 r942 60 60 static int 61 61 gperf_case_memcmp(register const char *s1, register const char *s2, 62 register unsigned int n)62 register unsigned int n) 63 63 { 64 64 for (; n > 0;) { … … 242 242 if (key <= MAX_HASH_VALUE && key >= 0) 243 243 if (len == lengthtable[key]) { 244 register const char *s = wordlist[key];245 246 if ((((unsigned char) *str ^ (unsigned char) *s) & ~32) == 0247 && !gperf_case_memcmp(str, s, len))248 return s;244 register const char *s = wordlist[key]; 245 246 if ((((unsigned char) *str ^ (unsigned char) *s) & ~32) == 0 247 && !gperf_case_memcmp(str, s, len)) 248 return s; 249 249 } 250 250 } 1.8.3/branches/experimental/src/lmath.c
r897 r942 64 64 #line 44 "lmath.gperf" 65 65 struct math { 66 const char *name; /**< Name of the function. */67 void (*func) (char **, int, char *, char **); /**< Pointer to function code. */66 const char *name; /**< Name of the function. */ 67 void (*func) (char **, int, char *, char **); /**< Pointer to function code. */ 68 68 }; 69 69 /* maximum key range = 52, duplicates = 0 */ … … 97 97 static int 98 98 gperf_case_memcmp(register const char *s1, register const char *s2, 99 register unsigned int n)99 register unsigned int n) 100 100 { 101 101 for (; n > 0;) { … … 161 161 #endif 162 162 struct math *math_hash_lookup(register const char *str, 163 register unsigned int len)163 register unsigned int len) 164 164 { 165 165 enum { … … 245 245 if (key <= MAX_HASH_VALUE && key >= 0) 246 246 if (len == lengthtable[key]) { 247 register const char *s = wordlist[key].name;248 249 if ((((unsigned char) *str ^ (unsigned char) *s) & ~32) == 0250 && !gperf_case_memcmp(str, s, len))251 return &wordlist[key];247 register const char *s = wordlist[key].name; 248 249 if ((((unsigned char) *str ^ (unsigned char) *s) & ~32) == 0 250 && !gperf_case_memcmp(str, s, len)) 251 return &wordlist[key]; 252 252 } 253 253 } 1.8.3/branches/experimental/src/wiz.c
r922 r942 48 48 #include "dbdefs.h" 49 49 #include "extmail.h" 50 50 #include "help.h" 51 51 52 52 #include "confmagic.h" … … 1777 1777 kill_info_slave(); 1778 1778 #endif 1779 free_help_indexes(); 1779 1780 local_shutdown(); 1780 1781 end_all_logs();
