From a5cc5f66f2f3367c18fbdb1efbce05120a723d62 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 24 May 2002 04:29:10 +0000 Subject: [PATCH] memory-mapped DB in sched server svn path=/trunk/boinc/; revision=52 --- TODO | 3 -- apps/Makefile.in | 2 +- apps/dependencies | 27 ----------- checkin_notes | 55 ++++++++++++++++++++++ client/config.log | 66 -------------------------- client/config.status | 44 +++++++++--------- config.log | 83 --------------------------------- config.status | 6 +-- db/db.h | 2 +- db/dependencies | 38 +++++++++------ doc/index.html | 20 ++++---- doc/install.html | 9 ++++ doc/intro.html | 10 ++-- doc/tools.html | 97 -------------------------------------- doc/tools_other.html | 49 ++++++++++++++++++++ doc/tools_work.html | 70 ++++++++++++++++++++++++++++ doc/work.html | 2 +- lib/Makefile | 8 +++- lib/Makefile.in | 8 +++- lib/md5_file.C | 6 ++- lib/shmem.C | 68 +++++++++++++++++++++++++++ lib/shmem.h | 21 +++++++++ lib/shmem_test.C | 27 +++++++++++ lib/synch.C | 86 ++++++++++++++++++++++++++++++++++ lib/synch.h | 6 +++ lib/synch_test.C | 21 +++++++++ sched/Makefile | 38 --------------- sched/Makefile.in | 18 ++++++- sched/handle_request.C | 40 +++++++++------- sched/handle_request.h | 3 +- sched/main.C | 18 +++++-- sched/server_types.C | 3 ++ sched/server_types.h | 3 ++ test/account.xml | 17 ------- test/account1.xml | 2 +- test/init.inc | 103 ++++++++++++++++++++++++++++++++++------- test/sched_reply.xml | 2 +- test/sched_request.xml | 13 +++--- test/test_uc.php | 1 + tools/add.C | 2 + tools/create_work.C | 9 ++-- 41 files changed, 665 insertions(+), 441 deletions(-) delete mode 100644 apps/dependencies delete mode 100644 doc/tools.html create mode 100644 doc/tools_other.html create mode 100644 doc/tools_work.html create mode 100755 lib/shmem.C create mode 100755 lib/shmem.h create mode 100644 lib/shmem_test.C create mode 100644 lib/synch.C create mode 100644 lib/synch.h create mode 100644 lib/synch_test.C delete mode 100644 sched/Makefile delete mode 100644 test/account.xml diff --git a/TODO b/TODO index 7ee9bf9ec7..50631d038a 100644 --- a/TODO +++ b/TODO @@ -14,9 +14,6 @@ HIGH-PRIORITY (must be done to support SETI@home) - proxy support -- add country, postal code to user - collect on login - - implement scheme for distributing scheduling server addresses each project provides a URL for file with list of scheduler address, and email address of "problems" contact diff --git a/apps/Makefile.in b/apps/Makefile.in index 89b662eee9..df318f02ad 100644 --- a/apps/Makefile.in +++ b/apps/Makefile.in @@ -32,7 +32,7 @@ uc_slow: uc_slow.o $(CC) 1sec.o $(LIBS) -o 1sec clean: - rm -f *.o $(APPS) + rm -f *.o $(APPS) dependencies dependencies: *.C $(CC) -M *.C > dependencies diff --git a/apps/dependencies b/apps/dependencies deleted file mode 100644 index f78edd658e..0000000000 --- a/apps/dependencies +++ /dev/null @@ -1,27 +0,0 @@ -1sec.o: 1sec.C /usr/include/stdio.h /usr/include/sys/feature_tests.h \ - /usr/include/sys/isa_defs.h /usr/include/sys/va_list.h \ - /usr/include/stdio_tag.h /usr/include/stdio_impl.h \ - /usr/include/time.h /usr/include/sys/types.h \ - /usr/include/sys/machtypes.h /usr/include/sys/int_types.h \ - /usr/include/sys/select.h /usr/include/sys/time.h \ - /usr/include/sys/time_impl.h -concat.o: concat.C /usr/include/stdio.h \ - /usr/include/sys/feature_tests.h /usr/include/sys/isa_defs.h \ - /usr/include/sys/va_list.h /usr/include/stdio_tag.h \ - /usr/include/stdio_impl.h -error.o: error.C /usr/include/stdio.h /usr/include/sys/feature_tests.h \ - /usr/include/sys/isa_defs.h /usr/include/sys/va_list.h \ - /usr/include/stdio_tag.h /usr/include/stdio_impl.h -uc_slow.o: uc_slow.C /usr/include/stdio.h \ - /usr/include/sys/feature_tests.h /usr/include/sys/isa_defs.h \ - /usr/include/sys/va_list.h /usr/include/stdio_tag.h \ - /usr/include/stdio_impl.h /usr/include/unistd.h \ - /usr/include/sys/types.h /usr/include/sys/machtypes.h \ - /usr/include/sys/int_types.h /usr/include/sys/select.h \ - /usr/include/sys/time.h /usr/include/time.h \ - /usr/include/sys/time_impl.h /usr/include/sys/unistd.h \ - /usr/include/ctype.h ../api/api.h -upper_case.o: upper_case.C /usr/include/stdio.h \ - /usr/include/sys/feature_tests.h /usr/include/sys/isa_defs.h \ - /usr/include/sys/va_list.h /usr/include/stdio_tag.h \ - /usr/include/stdio_impl.h /usr/include/ctype.h diff --git a/checkin_notes b/checkin_notes index df4c972f25..b62a4ea4a9 100755 --- a/checkin_notes +++ b/checkin_notes @@ -55,3 +55,58 @@ David A. May 15 2002 init.inc tools add.C +David A. May 23 2002 + - Change the scheduling server to reduce database accesses. + There's now a shared-memory segment that contains + 1) the platform, app, and app_version tables in their entirety; + 2) a fixed-size set of results ready to be sent, + and their corresponding workunit. + This segment is initialized and maintained by a new program + called the "feeder" (sched/feeder.C) that should run + whenever the scheduling server is up. + Note: the scheduler still needs to be converted to fast CGI + - Added handy interfaces for dealing with shared memory and semaphores. + - Changed to utilities and scripts used for testing so that all + server-specific names (paths and URLs) come from environment + variables instead of being hardwired in the code. + You'll want to add these to your .tcshrc or whatever. + See the doc/install.html for details. + + Files: + TODO + apps/ + Makefile.in + client/ + app.C + db/ + db.h + doc/ + index.html + install.html + intro.html + tools.html (removed) + tools_other.html + tools_work.html + work.html + lib/ + Makefile.in + md5_file.C + shmem.C,h (new) + shmem_test.C (new) + synch.C,h (new) + synch_test.C (new) + sched/ + feeder.C (new) + Makefile.in + handle_request.C,h + main.C + sched_shmem.C,h (new) + server_types.C,h + test/ + account.xml (deleted) + account1.xml + init.inc + test_uc.php + tools/ + add.C + create_work.C diff --git a/client/config.log b/client/config.log index f0397d1917..01f816b0a7 100644 --- a/client/config.log +++ b/client/config.log @@ -9,99 +9,33 @@ configure:750: checking whether the C compiler (gcc ) works configure:766: gcc -o conftest conftest.c 1>&5 configure:792: checking whether the C compiler (gcc ) is a cross-compiler configure:797: checking whether we are using GNU C -configure:806: gcc -E conftest.c configure:825: checking whether gcc accepts -g configure:857: checking how to run the C preprocessor -configure:878: gcc -E conftest.c >/dev/null 2>conftest.out configure:939: checking for ranlib configure:987: checking for sin in -lm -configure:1006: gcc -o conftest -g -O2 conftest.c -lm 1>&5 -configure:999: warning: conflicting types for built-in function `sin' configure:1034: checking for gethostbyaddr in -lnsl -configure:1053: gcc -o conftest -g -O2 conftest.c -lnsl -lm 1>&5 configure:1081: checking for setservent in -lsocket -configure:1100: gcc -o conftest -g -O2 conftest.c -lsocket -lnsl -lm 1>&5 configure:1128: checking for strfind in -lgen -configure:1147: gcc -o conftest -g -O2 conftest.c -lgen -lsocket -lnsl -lm 1>&5 configure:1175: checking for strfind in -lgen configure:1218: checking for cerr in -lstdc++ -configure:1237: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 configure:1270: checking for dirent.h that defines DIR -configure:1283: gcc -c -g -O2 conftest.c 1>&5 configure:1308: checking for opendir in -ldir -configure:1327: gcc -o conftest -g -O2 conftest.c -ldir -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 -/disks/asimov/a/lang/gnu/H-sparc-sun-solaris2/lib/gcc-lib/sparc-sun-solaris2/2.7-96q3/../../../../sparc-sun-solaris2/bin/ld: cannot open -ldir: No such file or directory -collect2: ld returned 1 exit status -configure: failed program was: -#line 1316 "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 - builtin and then its argument prototype would still apply. */ -char opendir(); - -int main() { -opendir() -; return 0; } configure:1391: checking for ANSI C header files -configure:1404: gcc -E conftest.c >/dev/null 2>conftest.out -configure:1471: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 configure:1498: checking for fcntl.h -configure:1508: gcc -E conftest.c >/dev/null 2>conftest.out configure:1498: checking for sys/time.h -configure:1508: gcc -E conftest.c >/dev/null 2>conftest.out configure:1498: checking for unistd.h -configure:1508: gcc -E conftest.c >/dev/null 2>conftest.out configure:1498: checking for sys/select.h -configure:1508: gcc -E conftest.c >/dev/null 2>conftest.out configure:1498: checking for sys/statvfs.h -configure:1508: gcc -E conftest.c >/dev/null 2>conftest.out configure:1498: checking for sys/swap.h -configure:1508: gcc -E conftest.c >/dev/null 2>conftest.out configure:1536: checking for working const -configure:1590: gcc -c -g -O2 conftest.c 1>&5 configure:1611: checking for size_t configure:1644: checking whether time.h and sys/time.h may both be included -configure:1658: gcc -c -g -O2 conftest.c 1>&5 configure:1679: checking whether struct tm is in sys/time.h or time.h -configure:1692: gcc -c -g -O2 conftest.c 1>&5 configure:1716: checking for select -configure:1744: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 configure:1716: checking for socket -configure:1744: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 configure:1716: checking for strstr -configure:1744: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 configure:1716: checking for lockf -configure:1744: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 configure:1716: checking for flock -configure:1744: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 -/var/tmp/ccEZaiYq1.o: In function `main': -/var/tmp/ccEZaiYq1.o(.text+0x4): undefined reference to `flock' -collect2: ld returned 1 exit status -configure: failed program was: -#line 1721 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char flock(); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char flock(); - -int main() { - -/* 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_flock) || defined (__stub___flock) -choke me -#else -flock(); -#endif - -; return 0; } configure:1716: checking for strftime -configure:1744: gcc -o conftest -g -O2 conftest.c -lstdc++ -lgen -lsocket -lnsl -lm 1>&5 configure:1772: checking for sendmail configure:1808: checking for sendmail diff --git a/client/config.status b/client/config.status index 38505c38f4..e9d93fa7b9 100755 --- a/client/config.status +++ b/client/config.status @@ -2,9 +2,9 @@ # Generated automatically by configure. # Run this file to recreate the current configuration. # This directory was configured as follows, -# on host jill: +# on host localhost.localdomain: # -# ./configure +# configure # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. @@ -14,8 +14,8 @@ for ac_option do case "$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion" - exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;; + echo "running ${CONFIG_SHELL-/bin/sh} configure --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} configure --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "./config.status generated by autoconf version 2.13" exit 0 ;; @@ -39,9 +39,9 @@ s%@CFLAGS@%-g -O2%g s%@CPPFLAGS@%%g s%@CXXFLAGS@%%g s%@FFLAGS@%%g -s%@DEFS@% -DHAVE_LIBM=1 -DHAVE_LIBNSL=1 -DHAVE_LIBSOCKET=1 -DHAVE_LIBGEN=1 -DHAVE_STRFIND=1 -DHAVE_LIBSTDC__=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_STATVFS_H=1 -DHAVE_SYS_SWAP_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRSTR=1 -DHAVE_LOCKF=1 -DHAVE_STRFTIME=1 -DHAVE_LIB_SENDMAIL=1 %g +s%@DEFS@% -DHAVE_LIBM=1 -DHAVE_LIBNSL=1 -DHAVE_LIBSTDC__=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_STATVFS_H=1 -DHAVE_SYS_SWAP_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRSTR=1 -DHAVE_LOCKF=1 -DHAVE_FLOCK=1 -DHAVE_STRFTIME=1 -DHAVE_SBIN_SENDMAIL=1 -DHAVE_LIB_SENDMAIL=1 %g s%@LDFLAGS@%%g -s%@LIBS@%-lstdc++ -lgen -lsocket -lnsl -lm %g +s%@LIBS@%-lstdc++ -lnsl -lm %g s%@exec_prefix@%${prefix}%g s%@prefix@%/usr/local%g s%@program_transform_name@%s,x,x,%g @@ -57,25 +57,25 @@ s%@includedir@%${prefix}/include%g s%@oldincludedir@%/usr/include%g s%@infodir@%${prefix}/info%g s%@mandir@%${prefix}/man%g -s%@host@%sparc-sun-solaris2.7%g -s%@host_alias@%sparc-sun-solaris2.7%g -s%@host_cpu@%sparc%g -s%@host_vendor@%sun%g -s%@host_os@%solaris2.7%g -s%@target@%sparc-sun-solaris2.7%g -s%@target_alias@%sparc-sun-solaris2.7%g -s%@target_cpu@%sparc%g -s%@target_vendor@%sun%g -s%@target_os@%solaris2.7%g -s%@build@%sparc-sun-solaris2.7%g -s%@build_alias@%sparc-sun-solaris2.7%g -s%@build_cpu@%sparc%g -s%@build_vendor@%sun%g -s%@build_os@%solaris2.7%g +s%@host@%i686-pc-linux-gnu%g +s%@host_alias@%i686-pc-linux-gnu%g +s%@host_cpu@%i686%g +s%@host_vendor@%pc%g +s%@host_os@%linux-gnu%g +s%@target@%i686-pc-linux-gnu%g +s%@target_alias@%i686-pc-linux-gnu%g +s%@target_cpu@%i686%g +s%@target_vendor@%pc%g +s%@target_os@%linux-gnu%g +s%@build@%i686-pc-linux-gnu%g +s%@build_alias@%i686-pc-linux-gnu%g +s%@build_cpu@%i686%g +s%@build_vendor@%pc%g +s%@build_os@%linux-gnu%g s%@CC@%gcc%g s%@CPP@%gcc -E%g s%@RANLIB@%ranlib%g -s%@HAVE_SBIN_SENDMAIL@%0%g +s%@HAVE_SBIN_SENDMAIL@%/usr/sbin/sendmail%g s%@HAVE_LIB_SENDMAIL@%/usr/lib/sendmail%g CEOF diff --git a/config.log b/config.log index 2c8639bb9e..bd06694754 100644 --- a/config.log +++ b/config.log @@ -6,115 +6,32 @@ configure:642: checking whether the C compiler (gcc ) works configure:658: gcc -o conftest conftest.c 1>&5 configure:684: checking whether the C compiler (gcc ) is a cross-compiler configure:689: checking whether we are using GNU C -configure:698: gcc -E conftest.c configure:717: checking whether gcc accepts -g configure:749: checking whether make sets ${MAKE} configure:777: checking for main in -lgen -configure:792: gcc -o conftest -g -O2 conftest.c -lgen 1>&5 configure:820: checking for main in -lm -configure:835: gcc -o conftest -g -O2 conftest.c -lm -lgen 1>&5 configure:863: checking for main in -lnsl -configure:878: gcc -o conftest -g -O2 conftest.c -lnsl -lm -lgen 1>&5 configure:906: checking for main in -lsocket -configure:921: gcc -o conftest -g -O2 conftest.c -lsocket -lnsl -lm -lgen 1>&5 configure:949: checking for main in -lstdc -configure:964: gcc -o conftest -g -O2 conftest.c -lstdc -lsocket -lnsl -lm -lgen 1>&5 -ld: fatal: library -lstdc: not found -ld: fatal: File processing errors. No output written to conftest -collect2: ld returned 1 exit status -configure: failed program was: -#line 957 "configure" -#include "confdefs.h" - -int main() { -main() -; return 0; } configure:992: checking for main in -lz -configure:1007: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1040: checking for dirent.h that defines DIR -configure:1053: gcc -c -g -O2 conftest.c 1>&5 configure:1078: checking for opendir in -ldir -configure:1097: gcc -o conftest -g -O2 conftest.c -ldir -lz -lsocket -lnsl -lm -lgen 1>&5 -ld: fatal: library -ldir: not found -ld: fatal: File processing errors. No output written to conftest -collect2: ld returned 1 exit status -configure: failed program was: -#line 1086 "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 - builtin and then its argument prototype would still apply. */ -char opendir(); - -int main() { -opendir() -; return 0; } configure:1161: checking how to run the C preprocessor -configure:1182: gcc -E conftest.c >/dev/null 2>conftest.out configure:1241: checking for ANSI C header files -configure:1254: gcc -E conftest.c >/dev/null 2>conftest.out -configure:1321: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1345: checking for sys/wait.h that is POSIX.1 compatible -configure:1366: gcc -c -g -O2 conftest.c 1>&5 configure:1390: checking for fcntl.h -configure:1400: gcc -E conftest.c >/dev/null 2>conftest.out configure:1390: checking for strings.h -configure:1400: gcc -E conftest.c >/dev/null 2>conftest.out configure:1390: checking for sys/time.h -configure:1400: gcc -E conftest.c >/dev/null 2>conftest.out configure:1390: checking for unistd.h -configure:1400: gcc -E conftest.c >/dev/null 2>conftest.out configure:1428: checking for working const -configure:1482: gcc -c -g -O2 conftest.c 1>&5 configure:1503: checking whether time.h and sys/time.h may both be included -configure:1517: gcc -c -g -O2 conftest.c 1>&5 configure:1540: checking whether gcc needs -traditional configure:1586: checking for vprintf -configure:1614: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1691: checking for wait3 that fills in rusage -configure:1730: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 -configure: failed program was: -#line 1699 "configure" -#include "confdefs.h" -#include -#include -#include -#include -/* HP-UX has wait3 but does not fill in rusage at all. */ -main() { - struct rusage r; - int i; - /* Use a field that we can force nonzero -- - voluntary context switches. - For systems like NeXT and OSF/1 that don't set it, - also use the system CPU time. And page faults (I/O) for Linux. */ - r.ru_nvcsw = 0; - r.ru_stime.tv_sec = 0; - r.ru_stime.tv_usec = 0; - r.ru_majflt = r.ru_minflt = 0; - switch (fork()) { - case 0: /* Child. */ - sleep(1); /* Give up the CPU. */ - _exit(0); - case -1: _exit(0); /* What can we do? */ - default: /* Parent. */ - wait3(&i, 0, &r); - sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */ - exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 - && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); - } -} configure:1755: checking for gethostname -configure:1783: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1755: checking for gettimeofday -configure:1783: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1755: checking for mkdir -configure:1783: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1755: checking for select -configure:1783: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1755: checking for socket -configure:1783: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1755: checking for strstr -configure:1783: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 configure:1755: checking for uname -configure:1783: gcc -o conftest -g -O2 conftest.c -lz -lsocket -lnsl -lm -lgen 1>&5 diff --git a/config.status b/config.status index 9221641680..0b351293bd 100755 --- a/config.status +++ b/config.status @@ -2,7 +2,7 @@ # Generated automatically by configure. # Run this file to recreate the current configuration. # This directory was configured as follows, -# on host jill: +# on host localhost.localdomain: # # configure # @@ -39,9 +39,9 @@ s%@CFLAGS@%-g -O2%g s%@CPPFLAGS@%%g s%@CXXFLAGS@%%g s%@FFLAGS@%%g -s%@DEFS@% -DHAVE_LIBGEN=1 -DHAVE_LIBM=1 -DHAVE_LIBNSL=1 -DHAVE_LIBSOCKET=1 -DHAVE_LIBZ=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_VPRINTF=1 -DHAVE_GETHOSTNAME=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_MKDIR=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRSTR=1 -DHAVE_UNAME=1 %g +s%@DEFS@% -DHAVE_LIBM=1 -DHAVE_LIBNSL=1 -DHAVE_LIBZ=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_VPRINTF=1 -DHAVE_WAIT3=1 -DHAVE_GETHOSTNAME=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_MKDIR=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRSTR=1 -DHAVE_UNAME=1 %g s%@LDFLAGS@%%g -s%@LIBS@%-lz -lsocket -lnsl -lm -lgen %g +s%@LIBS@%-lz -lnsl -lm %g s%@exec_prefix@%${prefix}%g s%@prefix@%/usr/local%g s%@program_transform_name@%s,x,x,%g diff --git a/db/db.h b/db/db.h index f133d8681c..9148d26105 100644 --- a/db/db.h +++ b/db/db.h @@ -29,7 +29,7 @@ #include -#define MAX_BLOB_SIZE 32767 +#define MAX_BLOB_SIZE 4096 // A compilation target, i.e. a architecture/OS combination. // Currently the core client will be given only applications diff --git a/db/dependencies b/db/dependencies index 339910c4d0..69f3e6f620 100644 --- a/db/dependencies +++ b/db/dependencies @@ -1,18 +1,26 @@ -db_mysql.o: db_mysql.C /usr/include/stdio.h \ - /usr/include/sys/feature_tests.h /usr/include/sys/isa_defs.h \ - /usr/include/sys/va_list.h /usr/include/stdio_tag.h \ - /usr/include/stdio_impl.h /usr/include/stdlib.h /usr/include/string.h \ - mysql_util.h mysql.h /usr/include/sys/types.h \ - /usr/include/sys/machtypes.h /usr/include/sys/int_types.h \ - /usr/include/sys/select.h /usr/include/sys/time.h /usr/include/time.h \ - /usr/include/sys/time_impl.h /usr/local/mysql/include/mysql_com.h \ +db_mysql.o: db_mysql.C /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \ + /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/stddef.h \ + /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/stdarg.h \ + /usr/include/bits/types.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/bits/stdio_lim.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \ + /usr/include/alloca.h /usr/include/string.h mysql_util.h mysql.h \ + /usr/local/mysql/include/mysql_com.h \ /usr/local/mysql/include/mysql_version.h db.h mysql_util.o: mysql_util.C /usr/include/stdio.h \ - /usr/include/sys/feature_tests.h /usr/include/sys/isa_defs.h \ - /usr/include/sys/va_list.h /usr/include/stdio_tag.h \ - /usr/include/stdio_impl.h /usr/include/string.h /usr/include/stdlib.h \ - mysql.h /usr/include/sys/types.h /usr/include/sys/machtypes.h \ - /usr/include/sys/int_types.h /usr/include/sys/select.h \ - /usr/include/sys/time.h /usr/include/time.h \ - /usr/include/sys/time_impl.h /usr/local/mysql/include/mysql_com.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/gnu/stubs.h \ + /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/stddef.h \ + /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/stdarg.h \ + /usr/include/bits/types.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/bits/stdio_lim.h \ + /usr/include/string.h /usr/include/stdlib.h /usr/include/sys/types.h \ + /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \ + /usr/include/alloca.h mysql.h /usr/local/mysql/include/mysql_com.h \ /usr/local/mysql/include/mysql_version.h mysql_util.h diff --git a/doc/index.html b/doc/index.html index 536951885e..563a43b247 100644 --- a/doc/index.html +++ b/doc/index.html @@ -17,18 +17,22 @@
  • Compute model: remote file access
  • Accounting and result validation
  • Back end examples -
  • Security -
  • Versioning -
  • The BOINC application library
  • Graphics - -
  • BOINC server-side tools -
  • Installing BOINC -
  • Project startup
  • Application development + +

    Operating a BOINC project

    +

    Participating in BOINC projects

    @@ -44,8 +48,6 @@
  • The BOINC client/server protocol -
  • The BOINC database -
  • Scheduling server: policy
  • Scheduling server: implementation
  • Scheduling server: debugging diff --git a/doc/install.html b/doc/install.html index 24c91571c6..511bea6751 100644 --- a/doc/install.html +++ b/doc/install.html @@ -16,6 +16,15 @@ by typing "configure" and "make". Edit your Apache configuration file (httpd.conf) to set the "boinc/sched" directory as CGI, and to allow uploads to to the upload directory. +

    +Add the following (with appropriate changes) to your .tcshrc +

    +setenv BOINC_DOWNLOAD_DIR   /home/david/html/download
    +setenv BOINC_UPLOAD_DIR     /home/david/html/upload
    +setenv BOINC_PLATFORM       i686-pc-linux-gnu
    +setenv BOINC_EMAIL          david@localhost.localdomain
    +setenv BOINC_URL_BASE       http://localhost.localdomain/download
    +

    Go into the boinc/test directory, and type diff --git a/doc/intro.html b/doc/intro.html index 46fe6a3bb8..d1d3e0c5be 100644 --- a/doc/intro.html +++ b/doc/intro.html @@ -4,7 +4,6 @@ Berkeley Open Infrastructure for Distributed Computing (BOINC) is a software platform for public-participation distributed computing projects like distributed.net and SETI@home. -BOINC is distributed under the Mozilla license. BOINC supports applications that can be divided into large parallel parts with few data dependencies; it is not intended for fine-grained parallel applications. @@ -25,10 +24,9 @@ and it allows participant hosts to do large data transfers unobtrusively.

  • BOINC supports applications with extreme requirements for memory or other resources. -Work units are dispatched only to hosts able to handle them. +Work is dispatched only to hosts able to handle it. -
  • BOINC applications can be developed in any language -(C++, Fortran, Perl). +
  • BOINC applications can be developed in any language (C++, Fortran, Perl). An application can consist of several files (e.g. several programs and a coordinating script). New versions of applications can be released without participant download. @@ -36,6 +34,8 @@ Separate alpha, beta, and production versions are distributed to the appropriate set of hosts.
  • The BOINC core client can run on almost any platform -(Mac, Windows, Linux and other Unix-type systems). +(Mac, Windows, Linux and other Unix systems). + +
  • BOINC is distributed under the Mozilla license. diff --git a/doc/tools.html b/doc/tools.html deleted file mode 100644 index 1351d67bbf..0000000000 --- a/doc/tools.html +++ /dev/null @@ -1,97 +0,0 @@ -

    BOINC operational tools

    - -

    -BOINC provides various tools for creating and operating projects. -These tools are accessed in several ways: - -

      -
    • Via a web interface. -These scripts are in the html_ops directory. -They are accessable only by users with the "manager" rights. -
    • Application programs. -These can be invoked from scripting languages. -
    • C++ functions. -
    - -
    -The C++ library (backend_lib.C,h) provides the following function: -
    -int create_work(
    -    int appid,
    -    char* wu_name,
    -    char* wu_template,
    -    char* result_template,
    -    int nresults,
    -    char* infile_dir,
    -    char** infiles,
    -    int ninfiles
    -);
    -
    - -

    -This creates a workunit and one or more results. -

    -"appid" is the database ID of the application. -

    -"wu_name" is the name of the workunit. -

    -"wu_name" is the filename of a template for the -workunit XML document. -This template is macro-substituted as follows: -

      -
    • INFILE_n is replaced with the name of the nth input file. -
    • MD5_n is replaced with the MD5 checksum of the nth input file. -
    • WU_NAME is replaced with the workunit name. -
    -

    -"result_template" is the filename of a template for the -result XML document. -This template is macro-substituted as follows: -

      -
    • OUTFILE_n is replaced with a string of the form -"wuname_resultnum_n" where wuname is the workunit name and -resultnum is the ordinal number of the result (0, 1, ...). -
    • WU_NAME is replaced with the workunit name. -
    • RESULT_NAME is replaced with a string of the form "wuname_resultnum". -
    -

    -"nresults" is the number of results to be created. -

    -"infile_dir" is the path of the directory where the input files are. -

    -"infiles" is an array of names of the input files, -of length "ninfiles". - -


    -The program -
    -create_work -appname file -wu_name file -wu_template file -result_template file -nresults n infile1 infile2 ...
    -
    -is a command-line equivalent of the create_work() function. - -

    -The program "add" performs various types of initialization: -

    -
    -add app name -
    -Create an application record. -
    -add platform name -
    -Create a platform record -
    -add app_version app-name platform-name version-num exec-dir exec-filename -
    -Create an app_version record. -
    -add user email_addr name web_password authenticator -
    -Create a user record. -
    -add prefs email_addr file -
    -Create a preference set, and make it the default -preferences for the given user. - -
    diff --git a/doc/tools_other.html b/doc/tools_other.html new file mode 100644 index 0000000000..26576fcd84 --- /dev/null +++ b/doc/tools_other.html @@ -0,0 +1,49 @@ +

    Operational tools: applications and versions

    + +

    +BOINC provides a few tools for creating and operating projects: + +

      +
    • Utility programs (such as add and create_work). +These can be run manually or invoked from scripts. +
    • C++ functions (such as create_work()). +
    • Web interfaces (currently these provide only read access). +
    +Projects can create their own tools, either at a low +level (e.g. directly accessing the BOINC DB from PHP or Perl scripts) +or by using the BOINC DB C++ API (db/db.h). + +

    The Add utility program

    +

    +The program add performs various types of initialization: +

    +
    +add app -app_name name +
    +Create a new application (just creates a DB record). +
    +add platform name -platform_name name +
    +Create a platform record (just creates a DB record); +
    +add app_version -app_name x -platform_name y -version a -exec_dir b -exec_file c -download_dir d -url_base e +
    +Create an app_version record. +Copy the executable file from the compilation directory +(-exec_dir) to the download directory. +Compute its MD5 checksum, fill in the DB record. +
    +add user -email_addr x -name y -web_password z -authenticator a +
    +Create a user record. +
    +add prefs -email_addr x -prefs_file y +
    +Create a preference set, and make it the default +preferences for the given user. +
    + +

    Web Interfaces

    +

    +The file show_db.php in the operational web site directory +displays the contents of the BOINC DB. diff --git a/doc/tools_work.html b/doc/tools_work.html new file mode 100644 index 0000000000..6ec52b0649 --- /dev/null +++ b/doc/tools_work.html @@ -0,0 +1,70 @@ +

    Operational tools: work and results

    + +

    +Workunits and results can be created using either +a utility program or a C++ function. +

    +The program +

    +create_work
    +    -appname name
    +    -wu_name name
    +    -wu_template file
    +    -result_template file
    +    -nresults n
    +    infile_1 ... infile_m
    +
    +

    +-appname specifies the name of the application +

    +-wu_name gives the name of the workunit. +

    +-wu_template gives the filename of a template for the +workunit XML document. +This template is macro-substituted as follows: +

      +
    • <INFILE_n/> is replaced with the name of the nth input file. +
    • <MD5_n/> is replaced with the MD5 checksum of the nth input file. +
    • <WU_NAME/> is replaced with the workunit name. +
    +

    +-result_template gives the filename of a template for the +result XML document. +This template is macro-substituted as follows: +

      +
    • <OUTFILE_n> is replaced with a string of the form +"wuname_resultnum_n" where wuname is the workunit name and +resultnum is the ordinal number of the result (0, 1, ...). +
    • <WU_NAME> is replaced with the workunit name. +
    • <RESULT_NAME> is replaced with a string of the form "wuname_resultnum". +
    +

    +-nresults gives the number of results to be created. +

    +infile_1 ... infile_m are the names of the input files. + +


    +

    +The C++ library (backend_lib.C,h) provides the function: +

    +int create_work(
    +    int appid,
    +    char* wu_name,
    +    char* wu_template,
    +    char* result_template,
    +    int nresults,
    +    char* infile_dir,
    +    char** infiles,
    +    int ninfiles
    +);
    +
    + +

    +This creates a workunit and one or more results. +The arguments are the same as for the utility program, +except that the application is identified by its database ID. +

    +"infile_dir" is the path of the directory containing the input files. +

    +"infiles" is an array of names of the input files, +of length "ninfiles". diff --git a/doc/work.html b/doc/work.html index 907e614044..86abed6ed9 100644 --- a/doc/work.html +++ b/doc/work.html @@ -17,7 +17,7 @@ how many times it has been dispatched, how many results have been returned, and how many failures have occurred.

    -The inputs of a workunit are described by an XML document of the form +The inputs to a workunit are described by an XML document of the form

     [ <file_info>...</file_info> ]
     [ ... ]
    diff --git a/lib/Makefile b/lib/Makefile
    index d87af8f483..a1c1497409 100644
    --- a/lib/Makefile
    +++ b/lib/Makefile
    @@ -5,7 +5,7 @@ CFLAGS = -g
     
     CC = gcc $(CFLAGS)
     
    -PROGS = md5_test
    +PROGS = md5_test shmem_test synch_test
     
     MD5_OBJS = \
         md5.o \
    @@ -24,6 +24,12 @@ all: $(PROGS) $(MD5_OBJS)
     md5_test: md5_test.o $(MD5_OBJS)
     	$(CC) md5_test.o $(MD5_OBJS) -o md5_test
     
    +shmem_test: shmem_test.o shmem.o
    +	$(CC) shmem_test.o shmem.o -o shmem_test
    +
    +synch_test: synch_test.o synch.o
    +	$(CC) synch_test.o synch.o -o synch_test
    +
     clean:
     	rm -f *.o $(PROGS) core dependencies
     
    diff --git a/lib/Makefile.in b/lib/Makefile.in
    index e5b413f62b..291d6038de 100644
    --- a/lib/Makefile.in
    +++ b/lib/Makefile.in
    @@ -4,7 +4,7 @@ CFLAGS = -g
     
     CC = @CC@ $(CFLAGS)
     
    -PROGS = md5_test
    +PROGS = md5_test shmem_test synch_test
     
     MD5_OBJS = \
         md5.o \
    @@ -23,6 +23,12 @@ all: $(PROGS) $(MD5_OBJS)
     md5_test: md5_test.o $(MD5_OBJS)
     	$(CC) md5_test.o $(MD5_OBJS) -o md5_test
     
    +shmem_test: shmem_test.o shmem.o
    +	$(CC) shmem_test.o shmem.o -o shmem_test
    +
    +synch_test: synch_test.o synch.o
    +	$(CC) synch_test.o synch.o -o synch_test
    +
     clean:
     	rm -f *.o $(PROGS) core dependencies
     
    diff --git a/lib/md5_file.C b/lib/md5_file.C
    index c85ff814c2..da35c5094b 100644
    --- a/lib/md5_file.C
    +++ b/lib/md5_file.C
    @@ -12,7 +12,11 @@ int md5_file(char* path, char* output, double& nbytes) {
     
         nbytes = 0;
         f = fopen(path, "r");
    -    if (!f) return -1;
    +    if (!f) {
    +        fprintf(stderr, "md5_file: can't open %s\n", path);
    +        perror("md5_file");
    +        return -1;
    +    }
         md5_init(&state);
         while (1) {
             n = fread(buf, 1, 4096, f);
    diff --git a/lib/shmem.C b/lib/shmem.C
    new file mode 100755
    index 0000000000..dc4cf98028
    --- /dev/null
    +++ b/lib/shmem.C
    @@ -0,0 +1,68 @@
    +#include 
    +#include 
    +#include 
    +
    +#include "shmem.h"
    +
    +int create_shmem(key_t key, int size, void** pp){
    +    int id;
    +    id = shmget(key, size, IPC_CREAT|0777);
    +    if (id < 0) {
    +        perror("create_shmem: shmget");
    +        return -1;
    +    }
    +    return attach_shmem(key, pp);
    +
    +}
    +
    +int destroy_shmem(key_t key){
    +    struct shmid_ds buf;
    +    int id, retval;
    +
    +    id = shmget(key, 0, 0);
    +    if (id < 0) return 0;           // assume it doesn't exist
    +    retval = shmctl(id, IPC_STAT, &buf);
    +    if (retval) return -1;
    +    if (buf.shm_nattch > 0) {
    +        fprintf(stderr,
    +            "destroy_shmem: can't destroy segment; %d attachments\n",
    +            buf.shm_nattch
    +        );
    +        return -1;
    +    }
    +    retval = shmctl(id, IPC_RMID, 0);
    +    if (retval) {
    +        fprintf(stderr, "destroy_shmem: remove failed %d\n", retval);
    +        return -1;
    +    }
    +    return 0;
    +}
    +
    +int attach_shmem(key_t key, void** pp){
    +    void* p;
    +    int id;
    +
    +    id = shmget(key, 0, 0);
    +    if (id < 0) {
    +        perror("attach_shmem: shmget");
    +        return -1;
    +    }
    +    p = shmat(id, 0, 0);
    +    if ((int)p == -1) {
    +        perror("attach_shmem: shmat");
    +        return -1;
    +    }
    +    *pp = p;
    +    return 0;
    +}
    +
    +int detach_shmem(key_t key) {
    +    int retval;
    +    void* p;
    +
    +    retval = attach_shmem(key, &p);
    +    if (retval) return retval;
    +    retval = shmdt(p);
    +    if (retval) perror("detach_shmem: shmdt");
    +    return retval;
    +}
    diff --git a/lib/shmem.h b/lib/shmem.h
    new file mode 100755
    index 0000000000..e8f46a2d39
    --- /dev/null
    +++ b/lib/shmem.h
    @@ -0,0 +1,21 @@
    +// platform-independent interface to shared memory
    +
    +#include 
    +
    +// create a shared-memory segment of the given size.
    +//
    +extern int create_shmem(key_t, int size, void**);
    +
    +// Destroy a shared-memory segment.
    +// If there are attachments to it,
    +// print a message in a loop until the attachments are gone
    +//
    +extern int destroy_shmem(key_t);
    +
    +// attach to a shared-memory segment
    +//
    +extern int attach_shmem(key_t, void**);
    +
    +// detach from a shared-mem segment
    +//
    +extern int detach_shmem(key_t);
    diff --git a/lib/shmem_test.C b/lib/shmem_test.C
    new file mode 100644
    index 0000000000..9ec1c626a3
    --- /dev/null
    +++ b/lib/shmem_test.C
    @@ -0,0 +1,27 @@
    +// test program for shmem functions
    +
    +// -a       attach and sleep
    +// -d       destroy
    +// -c       create
    +
    +#define KEY 0xbeefcafe
    +
    +#include 
    +#include 
    +#include 
    +
    +#include "shmem.h"
    +
    +main(int argc, char** argv) {
    +    void* p;
    +    int retval;
    +
    +    if (!strcmp(argv[1], "-a")) {
    +        retval = attach_shmem(KEY, &p);
    +        sleep(60);
    +    } else if (!strcmp(argv[1], "-d")) {
    +        destroy_shmem(KEY);
    +    } else if (!strcmp(argv[1], "-c")) {
    +        create_shmem(KEY, 100, &p);
    +    }
    +}
    diff --git a/lib/synch.C b/lib/synch.C
    new file mode 100644
    index 0000000000..c70ab64073
    --- /dev/null
    +++ b/lib/synch.C
    @@ -0,0 +1,86 @@
    +#include 
    +#include 
    +
    +#include "synch.h"
    +
    +union semun {
    +    int val;
    +    struct semid_ds *buf;
    +    unsigned short int *arra;
    +    struct seminfo *__buf;
    +};
    +
    +int create_semaphore(key_t key){
    +    int id, retval;
    +    semun s;
    +
    +    id = semget(key, 1, IPC_CREAT|IPC_EXCL|0777);
    +    if (id < 0) {
    +        perror("create_semaphore: semget");
    +        return -1;
    +    }
    +    memset(&s, 0, sizeof(s));
    +    s.val = 1;
    +    retval = semctl(id, 0, SETVAL, s);
    +    if (retval) {
    +        perror("create_semaphore: semctl");
    +        return -1;
    +    }
    +    return 0;
    +}
    +
    +int destroy_semaphore(key_t key){
    +    int id, retval;
    +    id = semget(key, 0, 0);
    +    if (id < 0) {
    +        perror("destroy_semaphore: semget");
    +        return -1;
    +    }
    +    retval = semctl(id, 1, IPC_RMID, 0);
    +    if (retval) {
    +        perror("destroy_semaphore: semctl");
    +        return -1;
    +    }
    +    return 0;
    +}
    +
    +int lock_semaphore(key_t key) {
    +    struct sembuf s;
    +    int id, retval;
    +
    +    id = semget(key, 0, 0);
    +    if (id < 0) {
    +        perror("lock_semaphore: semget");
    +        return -1;
    +    }
    +    s.sem_num = 0;
    +    s.sem_op = -1;
    +    s.sem_flg = SEM_UNDO;
    +    retval = semop(id, &s, 1);
    +    if (retval) {
    +        perror("lock_semaphore: semctl");
    +        return -1;
    +    }
    +    return 0;
    +}
    +
    +int unlock_semaphore(key_t key) {
    +    struct sembuf s;
    +    int id, retval;
    +
    +    id = semget(key, 0, 0);
    +    if (id < 0) {
    +        perror("unlock_semaphore: semget");
    +        return -1;
    +    }
    +    s.sem_num = 0;
    +    s.sem_op = 1;
    +    s.sem_flg = SEM_UNDO;
    +    retval = semop(id, &s, 1);
    +    if (retval) {
    +        perror("unlock_semaphore: semctl");
    +        return -1;
    +    }
    +    return 0;
    +}
    +
    diff --git a/lib/synch.h b/lib/synch.h
    new file mode 100644
    index 0000000000..f5a36dd976
    --- /dev/null
    +++ b/lib/synch.h
    @@ -0,0 +1,6 @@
    +#include 
    +
    +extern int create_semaphore(key_t);
    +extern int destroy_semaphore(key_t);
    +extern int lock_semaphore(key_t);
    +extern int unlock_semaphore(key_t);
    diff --git a/lib/synch_test.C b/lib/synch_test.C
    new file mode 100644
    index 0000000000..0bc8f99e5f
    --- /dev/null
    +++ b/lib/synch_test.C
    @@ -0,0 +1,21 @@
    +// -c       create semaphore
    +// -d       destroy semaphore
    +// -l       lock semaphore, sleep 10 secs, unlock
    +
    +#include 
    +
    +#include "synch.h"
    +
    +#define KEY 0xdeadbeef
    +
    +main(int argc, char** argv) {
    +    if (!strcmp(argv[1], "-c")) {
    +        create_semaphore(KEY);
    +    } else if (!strcmp(argv[1], "-d")) {
    +        destroy_semaphore(KEY);
    +    } else if (!strcmp(argv[1], "-l")) {
    +        lock_semaphore(KEY);
    +        sleep(10);
    +        unlock_semaphore(KEY);
    +    }
    +}
    diff --git a/sched/Makefile b/sched/Makefile
    deleted file mode 100644
    index 5b5f5f1ff1..0000000000
    --- a/sched/Makefile
    +++ /dev/null
    @@ -1,38 +0,0 @@
    -# Generated automatically from Makefile.in by configure.
    -all: cgi
    -
    -CFLAGS = -g -Wall -I ../db -I ../lib -I ../tools
    -CC = g++ $(CFLAGS)
    -
    -CLIBS = -lz -lsocket -lnsl -lm -lgen 
    -
    -CGI_OBJS = \
    -    handle_request.o \
    -    main.o \
    -    parse.o \
    -    server_types.o \
    -    ../db/db_mysql.o \
    -    ../db/mysql_util.o \
    -    ../tools/process_result_template.o
    -
    -MYSQL_DIR = /usr/local/mysql/lib
    -MYSQL_LIBS = \
    --L$(MYSQL_DIR) \
    --lmysqlclient -lz \
    --lm $(NETLIBS)
    -
    -.C.o:
    -	$(CC) -c -o $*.o $<
    -.c.o:
    -	$(CC) -c -o $*.o $<
    -
    -cgi: $(CGI_OBJS)
    -	$(CC) $(CGI_OBJS) $(MYSQL_LIBS) $(CLIBS) -o cgi
    -
    -dependencies: *.C
    -	$(CC) -M *.C > dependencies
    -
    -include dependencies
    -
    -clean:
    -	rm -f cgi *.o core dependencies config.cache
    diff --git a/sched/Makefile.in b/sched/Makefile.in
    index 902499728b..2b8f414a7b 100644
    --- a/sched/Makefile.in
    +++ b/sched/Makefile.in
    @@ -5,15 +5,28 @@ CC = g++ $(CFLAGS)
     
     CLIBS = @LIBS@
     
    +PROGS = cgi feeder
    +
    +all: $(PROGS)
    +
     CGI_OBJS = \
         handle_request.o \
         main.o \
         parse.o \
    +    sched_shmem.o \
         server_types.o \
         ../db/db_mysql.o \
         ../db/mysql_util.o \
    +    ../lib/shmem.o \
         ../tools/process_result_template.o
     
    +FEEDER_OBJS = \
    +    feeder.o \
    +    sched_shmem.o \
    +    ../db/db_mysql.o \
    +    ../db/mysql_util.o \
    +    ../lib/shmem.o
    +
     MYSQL_DIR = /usr/local/mysql/lib
     MYSQL_LIBS = \
     -L$(MYSQL_DIR) \
    @@ -28,10 +41,13 @@ MYSQL_LIBS = \
     cgi: $(CGI_OBJS)
     	$(CC) $(CGI_OBJS) $(MYSQL_LIBS) $(CLIBS) -o cgi
     
    +feeder: $(FEEDER_OBJS)
    +	$(CC) $(FEEDER_OBJS) $(MYSQL_LIBS) $(CLIBS) -o feeder
    +
     dependencies: *.C
     	$(CC) -M *.C > dependencies
     
     include dependencies
     
     clean:
    -	rm -f cgi *.o core dependencies config.cache
    +	rm -f $(PROGS) *.o core dependencies config.cache
    diff --git a/sched/handle_request.C b/sched/handle_request.C
    index bb8b917b02..3b6bdca405 100644
    --- a/sched/handle_request.C
    +++ b/sched/handle_request.C
    @@ -46,14 +46,14 @@ double estimate_duration(WORKUNIT& wu, HOST& host) {
     // Add the app and app_version to the reply also.
     //
     int add_wu_to_reply(
    -    WORKUNIT& wu, SCHEDULER_REPLY& reply, PLATFORM& platform, DB_CACHE& db
    +    WORKUNIT& wu, SCHEDULER_REPLY& reply, PLATFORM& platform, SCHED_SHMEM& ss
     ) {
         APP* app;
         APP_VERSION* app_version;
     
    -    app = db.lookup_app(wu.appid);
    +    app = ss.lookup_app(wu.appid);
         if (!app) return -1;
    -    app_version = db.lookup_app_version(app->id, platform.id, app->prod_vers);
    +    app_version = ss.lookup_app_version(app->id, platform.id, app->prod_vers);
         if (!app_version) return -1;
     
         // add the app, app_version, and workunit to the reply,
    @@ -248,22 +248,28 @@ int handle_results(
         return 0;
     }
     
    -// KLUDGE - query database for WUs.
    -// this must replaced for efficiency.
    -//
     int send_work(
         SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
    -    HOST& host, DB_CACHE& db
    +    HOST& host, SCHED_SHMEM& ss
     ) {
    -    int retval, nresults = 0;
    +    int i, retval, nresults = 0;
         WORKUNIT wu;
         RESULT result;
    +#if 0
         APP* app;
         char prefix [256];
    +#endif
     
    -    while (!db_result_enum_to_send(result, 1)) {
    -        db_workunit(result.workunitid, wu);
    -        retval = add_wu_to_reply(wu, reply, platform, db);
    +    for (i=0; i
     
    +#include "sched_shmem.h"
     #include "server_types.h"
     
    -extern void handle_request(FILE* fin, FILE* fout, DB_CACHE&);
    +extern void handle_request(FILE* fin, FILE* fout, SCHED_SHMEM&);
    diff --git a/sched/main.C b/sched/main.C
    index 3f237a7ea1..1472e70125 100644
    --- a/sched/main.C
    +++ b/sched/main.C
    @@ -22,6 +22,7 @@
     
     #include "db.h"
     #include "parse.h"
    +#include "shmem.h"
     #include "server_types.h"
     #include "handle_request.h"
     
    @@ -44,8 +45,20 @@ int main() {
         FILE* fin, *fout;
         int retval, pid;
         char req_path[256], reply_path[256];
    -    DB_CACHE db;
    +    SCHED_SHMEM* ssp;
    +    void* p;
     
    +    retval = attach_shmem(BOINC_KEY, &p);
    +    if (retval) {
    +        printf("can't attach shmem\n");
    +        exit(1);
    +    }
    +    ssp = (SCHED_SHMEM*)p;
    +    retval = ssp->verify();
    +    if (retval) {
    +        printf("shmem has wrong struct sizes - recompile\n");
    +        exit(1);
    +    }
         pid = getpid();
         sprintf(req_path, "%s%d", REQ_FILE_PREFIX, pid);
         sprintf(reply_path, "%s%d", REPLY_FILE_PREFIX, pid);
    @@ -71,8 +84,7 @@ int main() {
         if (retval) {
             exit(return_error("can't open database"));
         }
    -    db.read_db();
    -    handle_request(fin, fout, db);
    +    handle_request(fin, fout, *ssp);
         db_close();
     
         fclose(fin);
    diff --git a/sched/server_types.C b/sched/server_types.C
    index bce210eb56..1703d753db 100644
    --- a/sched/server_types.C
    +++ b/sched/server_types.C
    @@ -47,6 +47,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) {
             else if (parse_int(buf, "", hostid)) continue;
             else if (parse_int(buf, "", rpc_seqno)) continue;
             else if (parse_str(buf, "", platform_name)) continue;
    +        else if (parse_int(buf, "", core_client_version)) continue;
             else if (parse_int(buf, "", work_req_seconds)) continue;
             else if (parse_int(buf, "", (int)prefs_mod_time)) {
                 want_prefs = true;
    @@ -291,6 +292,7 @@ int HOST::parse_net_stats(FILE* fin) {
         return 1;
     }
     
    +#if 0
     DB_CACHE::DB_CACHE() {
     }
     
    @@ -347,3 +349,4 @@ APP_VERSION* DB_CACHE::lookup_app_version(
         }
         return 0;
     }
    +#endif
    diff --git a/sched/server_types.h b/sched/server_types.h
    index 1343b5cb39..a7d6809772 100644
    --- a/sched/server_types.h
    +++ b/sched/server_types.h
    @@ -29,6 +29,7 @@ struct SCHEDULER_REQUEST {
         char authenticator[256];
         char platform_name[256];
         int hostid;                 // zero if first RPC
    +    int core_client_version;
         int rpc_seqno;
         int work_req_seconds;
         bool want_prefs;
    @@ -65,6 +66,7 @@ struct SCHEDULER_REPLY {
         void insert_result(RESULT&);
     };
     
    +#if 0
     // stores the DB tables that don't change much
     //
     class DB_CACHE {
    @@ -78,5 +80,6 @@ public:
         APP* lookup_app(int id);
         APP_VERSION* lookup_app_version(int appid, int platformid, int version);
     };
    +#endif
     
     #endif
    diff --git a/test/account.xml b/test/account.xml
    deleted file mode 100644
    index 8ed9428aaf..0000000000
    --- a/test/account.xml
    +++ /dev/null
    @@ -1,17 +0,0 @@
    -
    -    
    -        
    -        localhost
    -        http://localhost/cgi-bin/boinc-cgi/cgi
    -        david@localhost
    -        3f7b90793a0175ad0bda68684e8bd136
    -        2
    -    
    -    
    -        zoot
    -        http://zoot/cgi-bin/boinc-cgi/cgi
    -        david@localhost
    -        3f7b90793a0175ad0bda68684e8bd136
    -        10
    -    
    -
    diff --git a/test/account1.xml b/test/account1.xml
    index 07823d85ce..a955bc98ee 100644
    --- a/test/account1.xml
    +++ b/test/account1.xml
    @@ -2,7 +2,7 @@
         
             
             localhost
    -        http://localhost/cgi-bin/boinc-cgi/cgi
    +        http://localhost/boinc-cgi/cgi
             david@localhost
             3f7b90793a0175ad0bda68684e8bd136
         
    diff --git a/test/init.inc b/test/init.inc
    index c494f629e8..4483001b11 100644
    --- a/test/init.inc
    +++ b/test/init.inc
    @@ -1,15 +1,15 @@
     
     10
    -no work available
    +no work available
     
         uc_wu_1
     
    diff --git a/test/sched_request.xml b/test/sched_request.xml
    index ba66ed8810..891af78961 100644
    --- a/test/sched_request.xml
    +++ b/test/sched_request.xml
    @@ -1,8 +1,9 @@
     
         3f7b90793a0175ad0bda68684e8bd136
         1
    -    2
    -    linux-intel
    +    1
    +    i686-pc-linux-gnu
    +    1
         1000
         0
     
    @@ -11,8 +12,8 @@
         1.000000
     
     
    -    44251.516532
    -    7238011.518940
    +    53220.549288
    +    6888091.886915
     
     
         28800
    @@ -30,7 +31,7 @@
         131072.000000
         178012160.000000
         22108344320.000000
    -    18234867712.000000
    +    18171138048.000000
     
     
         uc_wu_1
    @@ -42,7 +43,7 @@ APP: upper_case ending, wrote 54691 chars
     
     
         uc_wu_1_0
    -    http://localhost.localdomain/upload/uc_wu_1_0
    +    http://localhost/upload/uc_wu_1_0
         b0036fed2e472c34aae8ed05704c42e7
         54691.000000
     
    diff --git a/test/test_uc.php b/test/test_uc.php
    index 7cdfa3e234..b0edd30a27 100644
    --- a/test/test_uc.php
    +++ b/test/test_uc.php
    @@ -6,6 +6,7 @@
     
         include_once("init.inc");
     
    +    check_env_vars();
         clear_db();
         clear_data_dirs();
         init_client_dirs("account1.xml");
    diff --git a/tools/add.C b/tools/add.C
    index 9271a002ed..9b2e7ebb0e 100644
    --- a/tools/add.C
    +++ b/tools/add.C
    @@ -129,6 +129,7 @@ int main(int argc, char** argv) {
             strcpy(app.name, app_name);
             retval = db_app_lookup_name(app);
             if (retval) {
    +            fprintf(stderr, "can't find app %s\n", app_name);
                 db_print_error("db_app_lookup_name");
                 goto done;
             }
    @@ -136,6 +137,7 @@ int main(int argc, char** argv) {
             strcpy(platform.name, platform_name);
             retval = db_platform_lookup_name(platform);
             if (retval) {
    +            fprintf(stderr, "can't find platform %s\n", platform_name);
                 db_print_error("db_platform_lookup_name");
                 goto done;
             }
    diff --git a/tools/create_work.C b/tools/create_work.C
    index 4e4640a522..5267b63d63 100644
    --- a/tools/create_work.C
    +++ b/tools/create_work.C
    @@ -44,8 +44,6 @@
     #include "db.h"
     #include "backend_lib.h"
     
    -#define INFILE_DIR  "/disks/jill/a/inet_services/boinc_www/share/htdocs/download"
    -
     int main(int argc, char** argv) {
         APP app;
         WORKUNIT wu;
    @@ -55,7 +53,12 @@ int main(int argc, char** argv) {
         char wu_template_file[256], result_template_file[256];
         char** infiles;
         int i, ninfiles, nresults;
    +    char* boinc_download_dir = getenv("BOINC_DOWNLOAD_DIR");
     
    +    if (!boinc_download_dir) {
    +        printf("must define BOINC_DOWNLOAD_DIR");
    +        exit(1);
    +    }
         if( db_open("boinc") ) {
             printf( "Error opening database.\n" );
             exit(0);
    @@ -131,7 +134,7 @@ int main(int argc, char** argv) {
             wu_template,
             result_template,
             nresults,
    -        INFILE_DIR,
    +        boinc_download_dir,
             infiles,
             ninfiles
         );