server_R_2_0_6_1'.
Sprout from branch_4006 2010-04-15 14:34:42 UTC František Dvořák <valtri@civ.zcu.cz> 'The most recent version copied. Do not modify this instance (RW in ./org.glite.lb).'
Delete:
org.glite.lb.glite-LB/Makefile
org.glite.lb.glite-LB/configure
org.glite.lb.glite-LB/project/ChangeLog
org.glite.lb.glite-LB/project/package.description
org.glite.lb.glite-LB/project/package.summary
org.glite.lb.glite-LB/project/version.properties
org.glite.lb.logger/.cvsignore
org.glite.lb.logger/LICENSE
org.glite.lb.logger/Makefile
org.glite.lb.logger/build.xml
org.glite.lb.logger/config/glite-lb-logger.config.xml
org.glite.lb.logger/config/glite-lb-logger.default-properties
org.glite.lb.logger/config/startup
org.glite.lb.logger/configure
org.glite.lb.logger/doc/glite-lb-interlogd.8
org.glite.lb.logger/doc/glite-lb-logd.8
org.glite.lb.logger/project/ChangeLog
org.glite.lb.logger/project/build.number
org.glite.lb.logger/project/build.properties
org.glite.lb.logger/project/configure.properties.xml
org.glite.lb.logger/project/package.description
org.glite.lb.logger/project/package.summary
org.glite.lb.logger/project/properties.xml
org.glite.lb.logger/project/tar_exclude
org.glite.lb.logger/project/version.properties
org.glite.lb.logger/src-nt/Connection.H
org.glite.lb.logger/src-nt/Connection.cpp
org.glite.lb.logger/src-nt/EventManager.H
org.glite.lb.logger/src-nt/EventManager.cpp
org.glite.lb.logger/src-nt/Exception.H
org.glite.lb.logger/src-nt/HTTPTransport.H
org.glite.lb.logger/src-nt/HTTPTransport.cpp
org.glite.lb.logger/src-nt/InputChannel.H
org.glite.lb.logger/src-nt/InputChannel.cpp
org.glite.lb.logger/src-nt/Makefile
org.glite.lb.logger/src-nt/Message.H
org.glite.lb.logger/src-nt/MessageStore.H
org.glite.lb.logger/src-nt/MessageStore.cpp
org.glite.lb.logger/src-nt/PlainConnection.H
org.glite.lb.logger/src-nt/PlainConnection.cpp
org.glite.lb.logger/src-nt/PluginManager.H
org.glite.lb.logger/src-nt/PluginManager.cpp
org.glite.lb.logger/src-nt/Properties.H
org.glite.lb.logger/src-nt/Singleton.H
org.glite.lb.logger/src-nt/SocketInput.H
org.glite.lb.logger/src-nt/SocketInput.cpp
org.glite.lb.logger/src-nt/ThreadPool.H
org.glite.lb.logger/src-nt/ThreadPool.cpp
org.glite.lb.logger/src-nt/Transport.H
org.glite.lb.logger/src-nt/Transport.cpp
org.glite.lb.logger/src-nt/main.cpp
org.glite.lb.logger/src-nt/test/EventManagerTest.cpp
org.glite.lb.logger/src-nt/test/PluginManagerTest.cpp
org.glite.lb.logger/src-nt/test/SingletonTest.cpp
org.glite.lb.logger/src-nt/test/ThreadPoolTest.cpp
org.glite.lb.logger/src-nt/test/test_main.cpp
org.glite.lb.logger/src/event_queue.c
org.glite.lb.logger/src/event_store.c
org.glite.lb.logger/src/event_store_http.c
org.glite.lb.logger/src/http.c
org.glite.lb.logger/src/il_error.c
org.glite.lb.logger/src/il_error.h
org.glite.lb.logger/src/il_master.c
org.glite.lb.logger/src/input_queue_socket.c
org.glite.lb.logger/src/input_queue_socket_http.c
org.glite.lb.logger/src/interlogd.c
org.glite.lb.logger/src/interlogd.h
org.glite.lb.logger/src/logd.c
org.glite.lb.logger/src/logd_proto.c
org.glite.lb.logger/src/logd_proto.h
org.glite.lb.logger/src/perftest_il.sh
org.glite.lb.logger/src/perftest_ll.sh
org.glite.lb.logger/src/queue_mgr.c
org.glite.lb.logger/src/queue_mgr_http.c
org.glite.lb.logger/src/queue_thread.c
org.glite.lb.logger/src/recover.c
org.glite.lb.logger/src/send_event.c
org.glite.lb.logger/src/send_event_http.c
org.glite.lb.logger/src/server_msg.c
org.glite.lb.logger/src/server_msg_http.c
org.glite.lb.logger/test/IlTestBase.cpp
org.glite.lb.logger/test/IlTestBase.h
org.glite.lb.logger/test/event_queueTest.cpp
org.glite.lb.logger/test/event_storeTest.cpp
org.glite.lb.logger/test/il_test.cpp
org.glite.lb.logger/test/input_queue_socketTest.cpp
org.glite.lb.logger/test/ll_test.cpp
org.glite.lb.logger/test/logd_proto_test.c
org.glite.lb.logger/test/server_msgTest.cpp
org.glite.lb/.cvsignore
org.glite.lb/LICENSE
org.glite.lb/build.xml
org.glite.lb/configure
org.glite.lb/deployment/README
org.glite.lb/deployment/deploy_all.diff
org.glite.lb/deployment/deploy_jp.diff
org.glite.lb/deployment/deploy_lb.diff
org.glite.lb/doc/README.lb4vdt
org.glite.lb/doc/perf_clear_proxy
org.glite.lb/doc/perf_purge
org.glite.lb/doc/perf_reg_jobs
org.glite.lb/doc/perf_results/il_sci_09062006.txt
org.glite.lb/doc/perf_results/il_sci_09062006_01.txt
org.glite.lb/doc/perf_results/il_sci_12062006.txt
org.glite.lb/doc/perf_results/ll_michal_21062006.txt
org.glite.lb/doc/perf_results/proxy2serv_umbar2sci_22062006.txt
org.glite.lb/doc/perf_results/proxy2serv_umbar2sci_23062006.txt
org.glite.lb/doc/perf_results/proxy_sci_09062006.txt
org.glite.lb/doc/perf_run_interlogd
org.glite.lb/doc/perf_run_proxy
org.glite.lb/doc/perf_run_server
org.glite.lb/doc/perf_run_test
org.glite.lb/etics-tag-consistency.pl
org.glite.lb/etics-tag-with-subsystems.pl
org.glite.lb/etics-tag.pl
org.glite.lb/lb4vdt/LB_install.sh
org.glite.lb/lb4vdt/Makefile.inc
org.glite.lb/lb4vdt/scripts/org.gridsite.core.build
org.glite.lb/project/build.number
org.glite.lb/project/build.properties
org.glite.lb/project/glite.lb.csf.xml
org.glite.lb/project/package.description
org.glite.lb/project/package.summary
org.glite.lb/project/properties.xml
org.glite.lb/project/run-workspace
org.glite.lb/project/taskdefs.xml
org.glite.lb/project/version.properties
+++ /dev/null
-top_srcdir=..
-stagedir=.
-package=glite-lb-yaim
-version=0.0.0
-PREFIX=/opt/glite
-
--include Makefile.inc
--include ../project/version.properties
-
-default all:
- echo -e "${gLiteCopyrightText}\n\n${gLiteLicenseText}" > LICENSE
- cp LICENSE COPYRIGHT
- echo ${module.version}-${module.age} > node-version
- echo ${platformArch} > arch
- echo "NA" > service
- echo "NA" > update
-
-install:
- mkdir -p ${PREFIX}/release/glite-LB
- cp -fp LICENSE COPYRIGHT node-version arch service update ${PREFIX}/release/glite-LB/
-
-stage:
- $(MAKE) install PREFIX=${stagedir}
-
-check:
-
-clean:
-
-.PHONY: default all check install stage clean
+++ /dev/null
-#!/usr/bin/perl
-
-# WARNING: Don't edit this file unless it is the master copy in org.glite.lb
-#
-# For the purpose of standalone builds of lb/jobid/lbjp-common components
-# it is copied on tagging
-
-# $Header$
-
-use Getopt::Long;
-
-my $pwd = `pwd`; chomp $pwd;
-my $prefix = $pwd.'/stage';
-my $stagedir;
-my $staged;
-my $module;
-my $thrflavour = 'gcc64dbgpthr';
-my $nothrflavour = 'gcc64dbg';
-my $mode = 'build';
-my $help = 0;
-my $listmodules;
-my $version;
-my $output;
-my $lb_tag = '';
-my $lbjp_tag = '';
-my $jp_tag = '';
-my $sec_tag = '';
-my $jobid_tag = '';
-my $libdir = 'lib';
-
-my @nodes = qw/client server logger utils doc ws-test db jpprimary jpindex jpclient/;
-my %enable_nodes;
-my %disable_nodes;
-
-my %extern_prefix = (
- cares => '/opt/c-ares',
- classads => '/opt/classads',
- cppunit => '/usr',
- expat => '/usr',
- globus => '/opt/globus',
- jglobus => '/opt/globus',
- gsoap => '/usr',
- mysql => '/usr',
- 'mysql-devel' => '',
- 'mysql-server' => '',
- voms => '/opt/glite',
- gridsite => '/opt/glite',
- lcas => '/opt/glite',
- ant => '/usr',
- jdk => '/usr',
- libtar => '/usr',
-);
-
-my %jar = (
- 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar',
-);
-
-
-my %glite_prefix;
-my %need_externs;
-my %need_externs_type;
-my %need_jars;
-my %extrafull;
-my %extranodmod;
-my %deps;
-my %deps_type;
-my %topbuild;
-
-my %lbmodules = (
- 'lb' => [ qw/client common doc logger server state-machine types utils ws-interface ws-test glite-LB/],
- 'security' => [qw/gss gsoap-plugin/],
- 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/],
- 'jobid' => [qw/api-c api-cpp/],
- 'jp' => [ qw/client doc index primary server-common ws-interface/ ],
- );
-
-
-my @opts = (
- 'prefix=s' => \$prefix,
- 'staged=s' => \$staged,
- 'module=s' => \$module,
- 'thrflavour=s' => \$thrflavour,
- 'nothrflavour=s' => \$nothrflavour,
- 'mode=s' => \$mode,
- 'listmodules=s' => \$listmodules,
- 'version=s' => \$version,
- 'output=s' => \$output,
- 'stage=s' => \$stagedir,
- 'lb-tag=s' => \$lb_tag,
- 'lbjp-common-tag=s' => \$lbjp_tag,
- 'jp-tag=s' => \$jp_tag,
- 'security-tag=s' => \$sec_tag,
- 'jobid-tag=s' => \$jobid_tag,
- 'help' => \$help,
- 'libdir=s' => \$libdir,
-);
-
-for (@nodes) {
- $enable_nodes{$_} = 0;
- $disable_nodes{$_} = 0;
-
- push @opts,"disable-$_",\$disable_nodes{$_};
- push @opts,"enable-$_",\$enable_nodes{$_};
-}
-
-push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix;
-push @opts,"with-$_=s",\$jar{$_} for keys %jar;
-
-my @keeparg = @ARGV;
-
-GetOptions @opts or die "Errors parsing command line\n";
-
-$extern_prefix{'mysql-devel'}=$extern_prefix{mysql} if $extern_prefix{'mysql-devel'} eq '';
-$extern_prefix{'mysql-server'}=$extern_prefix{mysql} if $extern_prefix{'mysql-server'} eq '';
-
-if ($help) { usage(); exit 0; }
-
-if ($listmodules) {
- my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}};
- print "@m\n";
- exit 0;
-}
-
-warn "$0: --version and --output make sense only in --mode=etics\n"
- if ($version || $output) && $mode ne 'etics';
-
-my $en;
-for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; }
-
-my $dis;
-for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; }
-
-die "--enable-* and --disable-* are mutually exclusive\n"
- if $en && $dis;
-
-die "--module cannot be used with --enable-* or --disable-*\n"
- if $module && ($en || $dis);
-
-die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}};
-
-if ($dis) {
- for (@nodes) {
- $enable_nodes{$_} = 1 unless $disable_nodes{$_};
- }
-}
-
-if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ;
-
-for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; }
-
-$stagedir = $prefix unless $stagedir;
-
-if ($mode eq 'build') {
- print "Writing config.status\n";
- open CONF,">config.status" or die "config.status: $!\n";
- print CONF "$0 @keeparg\n";
- close CONF;
-}
-
-
-my @modules;
-my %aux;
-
-if ($module) {
-# push @modules,split(/[,.]+/,$module);
- push @modules,$module;
-}
-else {
- @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes));
-
- my $n;
-
- do {
- local $"="\n";
- $n = $#modules;
- push @modules,(map @{$deps{$_}},@modules);
-
- undef %aux; @aux{@modules} = (1) x ($#modules+1);
- @modules = keys %aux;
- } while ($#modules > $n);
-}
-
-@aux{@modules} = (1) x ($#modules+1);
-delete $aux{$_} for (split /,/,$staged);
-@modules = keys %aux;
-
-mode_build() if $mode eq 'build';
-mode_checkout() if $mode eq 'checkout';
-mode_etics($module) if $mode eq 'etics';
-
-sub mode_build {
- print "\nBuilding modules: @modules\n";
-
- my @ext = map @{$need_externs{$_}},@modules;
- my @myjars = map @{$need_jars{$_}},@modules;
- undef %aux; @aux{@ext} = 1;
- @ext = keys %aux;
- undef %aux; @aux{@myjars} = (1) x ($#myjars+1);
- @myjars = keys %aux;
-
- print "\nRequired externals:\n";
- print "\t$_: $extern_prefix{$_}\n" for @ext;
- print "\t$_: $jar{$_}\n" for @myjars;
- print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n";
-
- mkinc($_) for @modules;
-
- print "Creating Makefile\n";
-
- open MAK,">Makefile" or die "Makefile: $!\n";
-
- print MAK "all: @modules\n\nclean:\n";
-
- for (@modules) {
- my $full = full($_);
- my $build = $topbuild{$_} ? '': '/build';
- print MAK "\tcd $full$build && \${MAKE} clean\n"
- }
-
- print MAK "\ndistclean:\n";
-
- for (@modules) {
- my $full = full($_);
- print MAK $topbuild{$_} ?
- "\tcd $full$build && \${MAKE} distclean\n" :
- "\trm -rf $full$build\n"
- }
-
- print MAK "\n";
-
- for (@modules) {
- my %ldeps; undef %ldeps;
- @ldeps{@{$deps{$_}}} = 1;
- for my $x (split /,/,$staged) { delete $ldeps{$x}; }
- my @dnames = $module ? () : keys %ldeps;
-
- my $full = full($_);
- my $build = $topbuild{$_} ? '': '/build';
-
- print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n";
- }
-
- close MAK;
-}
-
-sub mode_checkout() {
- for (@modules) {
- my $module = $_;
- my $tag = "";
- if ($lb_tag){
- for (@{$lbmodules{lb}}){
- if ("lb.".$_ eq $module){
- $tag = '-r '.$lb_tag;
- }
- }
- }
- if ($lbjp_tag){
- for (@{$lbmodules{'lbjp-common'}}){
- if ("lbjp-common.".$_ eq $module){
- $tag = '-r '.$lbjp_tag;
- }
- }
- }
- if ($jp_tag){
- for (@{$lbmodules{'jp'}}){
- if ("jp.".$_ eq $module){
- $tag = '-r '.$jp_tag;
- }
- }
- }
- if ($sec_tag){
- for (@{$lbmodules{security}}){
- if ("security.".$_ eq $module){
- $tag = '-r '.$sec_tag;
- }
- }
- }
- if ($jobid_tag){
- for (@{$lbmodules{jobid}}){
- if ("jobid.".$_ eq $module){
- $tag = '-r '.$jobid_tag;
- }
- }
- }
- #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){
- # print "found";
- #}
- $_ = full($_);
- print "\n*** Checking out $_\n";
- system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n";
- }
-}
-
-BEGIN{
-%need_externs_aux = (
- 'lb.client' => [ qw/cppunit:B classads/ ],
- 'lb.client-java' => [ qw/ant:B jglobus jdk:B/ ],
- 'lb.common' => [ qw/expat cppunit:B classads/ ],
- 'lb.doc' => [],
- 'lb.logger' => [ qw/cppunit:B/ ],
- 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite/ ],
- 'lb.state-machine' => [ qw/classads/ ],
- 'lb.utils' => [ qw/cppunit:B/ ],
- 'lb.ws-interface' => [],
- 'lb.ws-test' => [ qw/gsoap:B/ ],
- 'lb.types' => [ qw// ],
- 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R yaim:R/ ],
- 'lbjp-common.db' => [ qw/mysql:R mysql-devel:B/ ],
- 'lbjp-common.maildir' => [ qw// ],
- 'lbjp-common.server-bones' => [ qw// ],
- 'lbjp-common.trio' => [ qw/cppunit:B/ ],
- 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ],
- 'security.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B/ ],
- 'security.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares gsoap:B/ ],
- 'jobid.api-c' => [ qw/cppunit:B/ ],
- 'jobid.api-cpp' => [ qw/cppunit:B/ ],
- 'jobid.api-java' => [ qw/ant:B jdk:B/ ],
- 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ],
- 'jp.doc' => [],
- 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ],
- 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ],
- 'jp.server-common' => [],
- 'jp.ws-interface' => [],
-);
-
-for my $ext (keys %need_externs_aux) {
- for (@{$need_externs_aux{$ext}}) {
- /([^:]*)(?::(.*))?/;
- push @{$need_externs{$ext}},$1;
- my $type = $2 ? $2 : 'BR';
- $need_externs_type{$ext}->{$1} = $type;
- }
-}
-
-%need_jars = (
- 'jobid.api-java' => [ qw/commons-codec/ ],
-);
-
-for my $jar (keys %need_jars) {
- for (@{$need_jars{$jar}}) {
- $need_externs_type{$jar}->{$_} = 'BR'; # XXX
- }
-}
-
-%deps_aux = (
- 'lb.client' => [ qw/
- lb.types:B lb.common
- lbjp-common.trio
- jobid.api-cpp:B jobid.api-c
- security.gss
- / ],
- 'lb.client-java' => [ qw/
- lb.types:B
- jobid.api-java
- / ],
- 'lb.common' => [ qw/
- jobid.api-cpp:B jobid.api-c
- lb.types:B lbjp-common.trio security.gss
- / ],
- 'lb.doc' => [ qw/lb.types:B/ ],
- 'lb.logger' => [ qw/
- lbjp-common.trio
- jobid.api-c
- lb.common
- security.gss
- / ],
- 'lb.server' => [ qw/
- lb.ws-interface lb.types:B lb.common lb.state-machine
- lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir
- jobid.api-c
- security.gsoap-plugin security.gss
- / ],
- 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface security.gss/ ],
- 'lb.utils' => [ qw/
- lbjp-common.jp-interface
- jobid.api-c
- lbjp-common.trio lbjp-common.maildir
- lb.client lb.state-machine
- / ],
- 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ],
- 'lb.ws-interface' => [ qw/lb.types:B/ ],
- 'lb.types' => [ qw// ],
- 'lb.glite-LB' => [ qw/
- lb.logger:R lb.server:R lb.utils:R lb.doc:R
- lb.ws-test:R
- / ],
- 'lbjp-common.db' => [ qw/lbjp-common.trio/ ],
- 'lbjp-common.maildir' => [ qw// ],
- 'lbjp-common.server-bones' => [ qw// ],
- 'lbjp-common.trio' => [ qw// ],
- 'security.gss' => [ qw// ],
- 'security.gsoap-plugin' => [ qw/security.gss/ ],
- 'jobid.api-c' => [ qw// ],
- 'jobid.api-cpp' => [ qw/jobid.api-c/ ],
- 'jobid.api-java' => [ qw// ],
-
- 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ],
-
- 'jp.client' => [ qw/
- jp.ws-interface
- lbjp-common.jp-interface lbjp-common.maildir
- jobid.api-c
- security.gsoap-plugin
- / ],
- 'jp.doc' => [ qw// ],
- 'jp.index' => [ qw/
- jp.server-common jp.ws-interface
- lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
- security.gsoap-plugin
- / ],
- 'jp.primary' => [ qw/
- jobid.api-c
- jp.server-common jp.ws-interface
- lb.state-machine
- lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
- security.gsoap-plugin
- / ],
- 'jp.server-common' => [ qw/
- lbjp-common.jp-interface lbjp-common.db
- / ],
- 'jp.ws-interface' => [ qw// ],
-);
-
-for my $ext (keys %deps_aux) {
- for (@{$deps_aux{$ext}}) {
- /([^:]*)(?::(.*))?/;
- push @{$deps{$ext}},$1;
- my $type = $2 ? $2 : 'BR';
- $deps_type{$ext}->{$1} = $type;
- }
-}
-
-
-%extrafull = ( gridsite=>'org.gridsite.core');
-
-#( java => 'client-java' );
-%extranodmod = (
- db => 'lbjp-common.db',
- jpprimary => 'jp.primary',
- jpindex => 'jp.index',
- jpclient => 'jp.client',
-);
-
-my @t = qw/lb.client-java jobid.api-java lb.types/;
-@topbuild{@t} = (1) x ($#t+1);
-}
-
-sub full
-{
- my $short = shift;
- return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short;
-}
-
-sub mkinc
-{
- my %aux;
- undef %aux;
- my @m=qw/
-lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java
-security.gss security.gsoap-plugin
-jobid.api-c jobid.api-cpp jobid.api-java
-lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface
-jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface
-/;
- @aux{@m} = (1) x ($#m+1);
-
- my $short = shift;
- my $full = full $short;
-
- unless ($aux{$short}) {
- print "Makefile.inc not needed in $full\n";
- return;
- }
-
- my $build = '';
-
- unless ($topbuild{$_}) {
- $build = '/build';
- unless (-d "$full/build") {
- mkdir "$full/build" or die "mkdir $full/build: $!\n";
- }
- unlink "$full/build/Makefile";
- symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n";
- }
-
- open MKINC,">$full$build/Makefile.inc"
- or die "$full$build/Makefile.inc: $!\n";
-
- print "Creating $full$build/Makefile.inc\n";
-
- print MKINC qq{
-PREFIX = $prefix
-stagedir = $stagedir
-thrflavour = $thrflavour
-nothrflavour = $nothrflavour
-libdir = $libdir
-};
-
- for (@{$need_externs{$short}}) {
- print MKINC "${_}_prefix = $extern_prefix{$_}\n"
- }
-
- for (@{$need_jars{$short}}) {
- print MKINC "${_}_jar = $jar{$_}\n"
- }
-
- my $need_gsoap = 0;
- for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; }
-
- print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap;
-
- close MKINC;
-}
-
-my %etics_externs;
-my %etics_projects;
-BEGIN{
- %etics_externs = (
- globus_essentials=>'vdt_globus_essentials',
- globus=>'globus',
- cares=>'c-ares',
- voms=>'org.glite.security.voms-api-cpp',
- gridsite=>'org.gridsite.shared',
- lcas=>'org.glite.security.lcas',
- trustmanager=>'org.glite.security.trustmanager',
- utiljava=>'org.glite.security.util-java',
- yaim=>'org.glite.yaim.lb',
- gpt=>'gpt',
- fetchcrl=>'fetch-crl',
- gip_release=>'glite-info-provider-release',
- gip_service=>'glite-info-provider-service',
- bdii=>'bdii',
- glite_version=>'glite-version',
- glite_info_templates=>'glite-info-templates',
- glue_schema=>'glue-schema',
- );
- %etics_projects = (
- vdt=>[qw/globus globus_essentials/],
- 'org.glite'=>[qw/voms gridsite lcas gpt gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim/],
- );
-};
-
-sub mode_etics {
- $fmod = shift;
-
- die "$0: --module required with --etics\n" unless $fmod;
-
- my ($subsys,$module) = split /\./,$fmod;
-
- my ($major,$minor,$rev,$age);
-
- if ($version) {
- $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/;
- ($major,$minor,$rev,$age) = ($1,$2,$3,$4);
- }
- else {
- open V,"org.glite.$subsys.$module/project/version.properties"
- or die "org.glite.$subsys.$module/project/version.properties: $!\n";
-
- while ($_ = <V>) {
- chomp;
- ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/;
- $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/;
- }
- close V;
- }
-
- my @copts = ();
- my %ge;
- @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1);
-
- for (@{$need_externs{"$subsys.$module"}}) {
- if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
- push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}";
- }
- }
-
- for (@{$need_jars{"$subsys.$module"}}) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
-
- push @copts,"--with-$_ \${$eext.location}/$_*.jar";
- }
-
-
- my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}";
- my $file = $output ? $output : "$conf.ini";
- open C,">$file" or die "$file: $!\n";
-
- my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n";
-
- my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..';
-
- print STDERR "Writing $file\n";
- print C qq{
-[Configuration-$conf]
-profile = None
-moduleName = org.glite.$subsys.$module
-displayName = $conf
-description = org.glite.$subsys.$module
-projectName = org.glite
-age = $age
-deploymentType = None
-tag = $conf
-version = $major.$minor.$rev
-path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz
-
-[Platform-default:VcsCommand]
-displayName = None
-description = None
-tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName}
-branch = None
-commit = None
-checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName}
-
-[Platform-default:BuildCommand]
-postpublish = None
-packaging = None
-displayName = None
-description = None
-doc = None
-prepublish = None
-publish = None
-compile = make
-init = None
-install = make install
-clean = make clean
-test = make check
-configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --libdir=\${libdir} --module $subsys.$module @copts
-checkstyle = None
-
-[Platform-default:Property]
-$buildroot
-
-[Platform-default:DynamicDependency]
-
-};
- for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
-
- my $proj = 'externals';
- for my $p (keys %etics_projects) {
- for $m (@{$etics_projects{$p}}) {
- $proj = $p if $m eq $_;
- }
- }
-
- my $type = $need_externs_type{"$subsys.$module"}->{$_};
- print C "$proj|$eext = $type\n";
- }
-
- for (@{$deps{"$subsys.$module"}}) {
- my $type = $deps_type{"$subsys.$module"}->{$_};
- print C "org.glite|org.glite.$_ = $type\n";
- }
-
- close C;
-}
-
-sub gsoap_version {
- local $_;
- my $gsoap_version;
- open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n";
-
- while ($_ = <S>) {
- chomp;
-
- $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/;
- }
- close S;
- return $gsoap_version;
-}
-
-
-sub usage {
- my @ext = keys %extern_prefix;
- my @myjars, keys %jar;
-
- print STDERR qq{
-usage: $0 options
-
-General options (defaults in []):
- --prefix=PREFIX destination directory [./stage]
- --staged=module,module,... what is already in PREFIX (specify without org.glite.)
- --thrflavour=flavour
- --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg]
- --listmodules=subsys list modules of a subsystem
- --libdir=libdir typically [lib,lib64] postfix
-
-Mode of operation:
- --mode={checkout|build|etics} what to do [build]
-
-What to build:
- --module=module build this module only (mostly in-Etics operation)
- --enable-NODE build this "node" (set of modules) only. Available nodes are
- @{$lbmodules{lb}},@{$lbmodules{security}}
- --disable-NODE don't build this node
- --lb-tag=tag checkout LB modules with specific tag
- --jp-tag=tag checkout JP modules with specific tag
- --lbjp-common-tag=tag checkout lbjp-common modules with specific tag
- --security-tag=tag checkout security modules with specific tag
- --jobid-tag=tag checkout jobid modules with specific tag
-
-Dependencies:
- --with-EXTERNAL=PATH where to look for an external. Required externals
- (not all for all modules) are:
- @ext
- --with-JAR=JAR where to look for jars. Required jars are:
- @myjars
- Summary of what will be used is always printed
-
-};
-
-}
+++ /dev/null
-3.2.10-1
-- glite-LB Metapackage module now CVS-based
-- compile and build by make rather than inline commands
-
-3.2.1-1
-- CVS-based metapackage in LB 2.0 branch
-- patch #4006
+++ /dev/null
-Metapackage to install the L&B service on an LB node
+++ /dev/null
-Metapackage to install the L&B service on an LB node
+++ /dev/null
-# $Header
-module.version=3.2.1
-module.age=1
+++ /dev/null
-.project
-.cdtproject
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware\r
-================================\r
-\r
-Copyright (c) 2004 on behalf of the EU EGEE Project: \r
-The European Organization for Nuclear Research (CERN), \r
-Istituto Nazionale di Fisica Nucleare (INFN), Italy\r
-Datamat Spa, Italy\r
-Centre National de la Recherche Scientifique (CNRS), France\r
-CS Systeme d'Information (CSSI), France\r
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden\r
-Universiteit van Amsterdam (UvA), Netherlands\r
-University of Helsinki (UH.HIP), Finlan\r
-University of Bergen (UiB), Norway\r
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom\r
-\r
-Redistribution and use in source and binary forms, with or without\r
-modification, are permitted provided that the following conditions are\r
-met: \r
-\r
-1. Redistributions of source code must retain the above copyright\r
-notice, this list of conditions and the following disclaimer.\r
-\r
-2. Redistributions in binary form must reproduce the above copyright\r
-notice, this list of conditions and the following disclaimer in the\r
-documentation and/or other materials provided with the distribution.\r
-\r
-3. The end-user documentation included with the redistribution, if\r
-any, must include the following acknowledgment: "This product includes\r
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."\r
-Alternatively, this acknowledgment may appear in the software itself, if\r
-and wherever such third-party acknowledgments normally appear.\r
-\r
-4. The names EGEE and the EU EGEE Project must not be\r
-used to endorse or promote products derived from this software without\r
-prior written permission. For written permission, please contact\r
-<email address>.\r
-\r
-5. You are under no obligation whatsoever to provide anyone with any\r
-bug fixes, patches, or upgrades to the features, functionality or\r
-performance of the Software ("Enhancements") that you may develop over\r
-time; however, if you choose to provide your Enhancements to The EU\r
-EGEE Project, or if you choose to otherwise publish or distribute your\r
-Enhancements, in source code form without contemporaneously requiring\r
-end users of The EU EGEE Proejct to enter into a separate written license\r
-agreement for such Enhancements, then you hereby grant The EU EGEE Project\r
-a non-exclusive, royalty-free perpetual license to install, use, copy,\r
-modify, prepare derivative works, incorporate into the EGEE Middleware\r
-or any other computer software, distribute, and sublicense your\r
-Enhancements or derivative works thereof, in binary and source code\r
-form (if any), whether developed by The EU EGEE Project or third parties.\r
-\r
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED\r
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE\r
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-This software consists of voluntary contributions made by many\r
-individuals on behalf of the EU EGEE Prject. For more information on The\r
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on\r
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/\r
-\r
-\r
+++ /dev/null
-# defaults
-top_srcdir=..
-stagedir=.
-globalprefix=glite
-lbprefix=lb
-package=glite-lb-client
-version=0.0.0
-PREFIX=/opt/glite
-
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-
--include Makefile.inc
--include ../project/version.properties
-
-version=${module.version}
-
-CC=gcc
-
-VPATH:=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/doc
-
-VERSION=-DVERSION=\"GLite-${version}\"
-
-SUFFIXES=.no
-
-ifdef LB_STANDALONE
- LB_STANDALONE_FLAGS:=-DLB_STANDALONE
-endif
-
-ifdef LB_PERF
- LOGD:=glite-lb-logd-perf glite-lb-logd-perf-nofile
- INTERLOGD:=glite-lb-interlogd-perf \
- glite-lb-interlogd-perf-empty
-# glite-lb-interlogd-perf-inline-empty
- NOTIF_INTERLOGD:=glite-lb-notif-interlogd
- LB_PERF_FLAGS:=-DLB_PERF
-else
- LOGD:=glite-lb-logd
- INTERLOGD:=glite-lb-interlogd
- NOTIF_INTERLOGD:=glite-lb-notif-interlogd
- WS_INTERLOGD:=glite-lb-ws-interlogd
-endif
-
-DEBUG:=-g -O0
-CFLAGS:=${DEBUG} \
- -I${stagedir}/include -I${top_srcdir}/src \
- -D_GNU_SOURCE \
- ${COVERAGE_FLAGS} \
- ${VERSION} ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS}
-
-LDFLAGS:=-L${stagedir}/${libdir} \
- ${COVERAGE_FLAGS}
-LINK:=libtool --mode=link ${CC} ${LDFLAGS}
-LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/${libdir} ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-
-#ifneq (${expat_prefix},/usr)
-# EXPAT_LIBS:=-L${expat_prefix}/lib
-#endif
-#EXPAT_LIBS:=${EXPAT_LIBS} -lexpat
-#
-#EXT_LIBS:= ${EXPAT_LIBS}
-
-COMMON_LIB:=-lglite_lb_common
-
-TRIO_LIB:=-lglite_lbu_trio
-
-GLITE_GSS_LIB:=-lglite_security_gss
-
-TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit
-TEST_INC:=-I${cppunit_prefix}/include
-
-LOGD_OBJS:= logd_proto.o logd.o
-
-LOGD_NOBJS:=${LOGD_OBJS:.o=.no}
-
-INTERLOG_OBJS:=il_error.o input_queue_socket.o \
- recover.o send_event.o \
- event_queue.o event_store.o il_master.o interlogd.o \
- queue_mgr.o server_msg.o queue_thread.o
-
-WS_INTERLOG_OBJS:=il_error.o input_queue_socket_http.o \
- recover.o http.o send_event_http.o \
- event_queue.o event_store_http.o il_master.o interlogd.o \
- queue_mgr_http.o server_msg_http.o queue_thread.o
-
-INTERLOG_NOBJS:=${INTERLOG_OBJS:.o=.no}
-INTERLOG_WOBJS:=${WS_INTERLOG_OBJS:.o=.wo}
-INTERLOG_PERF_OBJS:=${INTERLOG_OBJS:.o=.perf.o}
-INTERLOG_EMPTY_OBJS:=${INTERLOG_OBJS:.o=.empty.o}
-#INTERLOG_INLINE_EMPTY_OBJS:=${INTERLOG_OBJS:.o=.io}
-
-INTERLOG_TEST_OBJS:= \
- il_error.o \
- server_msg.o \
- server_msgTest.o \
- queue_thread.o \
- event_store.o \
- event_storeTest.o \
- queue_mgr.o \
- il_master.o \
- input_queue_socket.o \
- input_queue_socketTest.o \
- send_event.o \
- event_queue.o \
- event_queueTest.o \
- IlTestBase.o \
- il_test.o
-
-MAN_GZ:=glite-lb-interlogd.8.gz glite-lb-logd.8.gz
-MAN = $(MAN_GZ:.gz=)
-
-default: all
-
-all compile: $(LOGD) $(INTERLOGD) $(NOTIF_INTERLOGD) ${MAN_GZ}
-
-glite-lb-logd: ${LOGD_OBJS}
- ${LINK} -o $@ ${LOGD_OBJS} ${COMMON_LIB}_${nothrflavour} ${TRIO_LIB}
-
-glite-lb-logd-perf: ${LOGD_OBJS}
- ${LINK} -o $@ ${LOGD_OBJS} ${COMMON_LIB}_${nothrflavour} ${TRIO_LIB}
-
-glite-lb-logd-nofile: ${LOGD_NOBJS}
- ${LINK} -o $@ ${LOGD_NOBJS} ${COMMON_LIB}_${nothrflavour}
-
-glite-lb-logd-perf-nofile: ${LOGD_NOBJS}
- ${LINK} -o $@ ${LOGD_NOBJS} ${COMMON_LIB}_${nothrflavour}
-
-glite-lb-interlogd: ${INTERLOG_OBJS}
- ${LINK} -o $@ ${INTERLOG_OBJS} ${COMMON_LIB}_${thrflavour}
-
-glite-lb-notif-interlogd: ${INTERLOG_NOBJS}
- ${LINK} -o $@ ${INTERLOG_NOBJS} ${COMMON_LIB}_${thrflavour}
-
-glite-lb-interlogd-perf: ${INTERLOG_PERF_OBJS}
- ${LINK} -o $@ ${INTERLOG_PERF_OBJS} ${COMMON_LIB}_${thrflavour}
-
-glite-lb-interlogd-perf-empty: ${INTERLOG_EMPTY_OBJS}
- ${LINK} -o $@ ${INTERLOG_EMPTY_OBJS} ${COMMON_LIB}_${thrflavour}
-
-glite-lb-ws-interlogd: ${INTERLOG_WOBJS}
- ${LINK} -o $@ ${INTERLOG_WOBJS} ${COMMON_LIB}_${thrflavour}
-
-#glite-lb-interlogd-perf-inline-empty: ${INTERLOG_INLINE_EMPTY_OBJS}
-# ${LINK} -o $@ ${INTERLOG_INLINE_EMPTY_OBJS} \
-# ${COMMON_LIB}_${thrflavour}
-
-${MAN_GZ}: ${MAN}
- rm -f ${MAN_GZ} ${MAN}
- cp $? .
- gzip -f $(notdir $?)
-
-man: ${MAN_GZ}
-
-stage: compile
- $(MAKE) install PREFIX=${stagedir}
-
-check:
-# do nothing until test/ is really added to CVS
-# check.ll check.il
-
-#check.ll: logd_proto_test.o ll_test.o
-# ${LINKXX} -o $@ ${COMMON_LIB}_${nothrflavour} ${EXT_LIBS} ${TEST_LIBS} $+
-# ./check.ll
-
-check.ll:
- -echo commented out -- fix needed
-
-check.il: ${INTERLOG_TEST_OBJS}
- ${LINKXX} -o $@ ${COMMON_LIB}_${thrflavour} ${GLITE_GSS_LIB}_${nothrflavour} ${TEST_LIBS} -lpthread $+
-
-install:
- -mkdir -p ${PREFIX}/bin
- -mkdir -p ${PREFIX}/etc/init.d
- -mkdir -p ${PREFIX}/share/doc/${package}-${version}
- -mkdir -p ${PREFIX}/share/man/man8
- ${INSTALL} -m 755 ${LOGD} ${PREFIX}/bin
- ${INSTALL} -m 755 ${INTERLOGD} ${PREFIX}/bin
- ${INSTALL} -m 755 ${NOTIF_INTERLOGD} ${PREFIX}/bin
-ifdef LB_PERF
- -mkdir -p ${PREFIX}/sbin
- ${INSTALL} -m 755 ${top_srcdir}/src/perftest_ll.sh ${PREFIX}/sbin
-endif
- ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-lb-locallogger
- ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
- ( cd ${top_srcdir}/project && ${INSTALL} -m 644 ChangeLog package.description package.summary ${PREFIX}/share/doc/${package}-${version} )
- ${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man8
-
-${INTERLOG_NOBJS}: %.no: %.c
- ${CC} ${CFLAGS} -DIL_NOTIFICATIONS -c $< -o $@
-
-${INTERLOG_OBJS}: %.o: %.c
- ${CC} ${CFLAGS} -c $< -o $@
-
-${INTERLOG_WOBJS}: %.wo: %.c
- ${CC} ${CFLAGS} -DIL_WS -c $< -o $@
-
-${INTERLOG_EMPTY_OBJS}: %.empty.o: %.c
- ${CC} ${CFLAGS} -DPERF_EMPTY -c $< -o $@
-
-${INTERLOG_PERF_OBJS}: %.perf.o: %.c
- ${CC} ${CFLAGS} -c $< -o $@
-
-#${INTERLOG_INLINE_EMPTY_OBJS}: %.io: %.c
-# ${CC} ${CFLAGS} -DLB_PERF -DPERF_EMPTY -DPERF_EVENTS_INLINE -c $< -o $@
-
-${LOGD_NOBJS}: %.no: %.c
- ${CC} ${CFLAGS} -DLOGD_NOFILE -c $< -o $@
-
-${LOGD_OBJS}: %.o: %.c
- ${CC} ${CFLAGS} -c $< -o $@
-
-logd_proto_test.o: %.o: %.c
- ${CC} ${CFLAGS} -c $< -o $@
-
-ll_test.o: %.o: %.cpp
- ${CXX} ${CFLAGS} ${TEST_INC} -c $< -o $@
-
-il_test.o IlTestBase.o server_msgTest.o event_queueTest.o input_queue_socketTest.o event_storeTest.o: %.o: %.cpp
- ${CXX} ${CFLAGS} ${TEST_INC} -c $< -o $@
-
-clean:
- rm -rvf .libs/ *.o *.no ${LOGD} ${INTERLOGD} ${NOTIF_INTERLOGD} ${MAN_GZ}
- rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite LB Client module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.5 2005/05/26 15:13:49 zurek
- inserted module.build.file
-
- Revision 1.4.2.1 2005/02/12 01:39:10 glbuild
- Changed start time
-
- Revision 1.4 2004/10/18 19:16:09 zsalvet
- RPM descriptions
-
- Revision 1.3 2004/07/29 23:21:51 dimeglio
- Changed default target from compile to dist
-
- Revision 1.2 2004/07/07 09:24:57 akrenek
- thr/nonthr flavours used correctly
-
- Revision 1.3 2004/07/06 17:45:30 flammer
- Update of classpath definitions, targets & configure file.
-
- Revision 1.2 2004/06/23 00:29:33 dimeglio
- Added standard comments and handling of support files
-
--->
-
-<project name="logger" default="dist">
-
- <!-- =========================================
- Builds the GLite LB Client Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
- <!-- =========================================
- RPM settings
- ========================================= -->
-
- <property name="build.package.summary" value="L&B local logger" />
- <property name="build.package.description" value="
-Daemons installed on any EGEE machine producing Logging & Bookkeeping
-(L&B)
events. They are responsible for non-blocking accept of
-an event, persistent
storage, and reliable transfer to bookkeeping server." />
-
-</project>
+++ /dev/null
-<service name="glite-lb-logger">
- <components>
-
- <component name="locallogger">
- <config-template>
- <description>glite_lb_logd daemon</description>
- <init>
- <param name="port" mandatory="false" type="int" advanced="false">
- <description>port to listen</description>
- </param>
- <param name="file-prefix" mandatory="false" type="string" advanced="false">
- <description>path and prefix for event files</description>
- </param>
- <param name="socket" mandatory="false" type="string" advanced="false">
- <description>path to local socket</description>
- </param>
- <param name="cert" mandatory="false" type="string" advanced="false">
- <description>location of server certificate</description>
- </param>
- <param name="key" mandatory="false" type="string" advanced="false">
- <description>location of server private key</description>
- </param>
- <param name="CAdir" mandatory="false" type="string" advanced="false">
- <description>"directory containing CA certificates"</description>
- </param>
- </init>
- </config-template>
- </component>
-
- <component name="interlogger">
- <config-template>
- <description>glite_lb_interlogd daemon</description>
- <init>
- <param name="file-prefix" mandatory="false" type="string" advanced="false">
- <description>path and prefix for event files</description>
- </param>
- <param name="socket" mandatory="false" type="string" advanced="false">
- <description>path to local socket</description>
- </param>
- <param name="cert" mandatory="false" type="string" advanced="false">
- <description>location of server certificate</description>
- </param>
- <param name="key" mandatory="false" type="string" advanced="false">
- <description>location of server private key</description>
- </param>
- <param name="CAdir" mandatory="false" type="string" advanced="false">
- <description>"directory containing CA certificates"</description>
- </param>
- </init>
- </config-template>
- </component>
-
- <component name="notification-interlogger">
- <config-template>
- <description>glite_lb_notif_interlogd daemon</description>
- <init>
- <param name="file-prefix" mandatory="false" type="string" advanced="false">
- <description>path and prefix for event files</description>
- </param>
- <param name="socket" mandatory="false" type="string" advanced="false">
- <description>path to local socket</description>
- </param>
- <param name="cert" mandatory="false" type="string" advanced="false">
- <description>location of server certificate</description>
- </param>
- <param name="key" mandatory="false" type="string" advanced="false">
- <description>location of server private key</description>
- </param>
- <param name="CAdir" mandatory="false" type="string" advanced="false">
- <description>"directory containing CA certificates"</description>
- </param>
- </init>
- </config-template>
- </component>
-
- </components>
-</service>
+++ /dev/null
-locallogger.port = 9002
-locallogger.file-prefix = /var/glite/log/dglogd.log
-locallogger.socket = /tmp/interlogger.sock
-locallogger.cert = /etc/grid-security/hostcert.pem
-locallogger.key = /etc/grid-security/hostkey.pem
-locallogger.CAdir = /etc/grid-security/certificates
-interlogger.file-prefix = /var/glite/log/dglogd.log
-interlogger.socket = /tmp/interlogger.sock
-interlogger.cert = /etc/grid-security/hostcert.pem
-interlogger.key = /etc/grid-security/hostkey.pem
-interlogger.CAdir = /etc/grid-security/certificates
-notification-interlogger.file-prefix = /tmp/notif_events
-notification-interlogger.socket = /tmp/notif_interlogger.sock
-notification-interlogger.cert = /etc/grid-security/hostcert.pem
-notification-interlogger.key = /etc/grid-security/hostkey.pem
-notification-interlogger.CAdir = /etc/grid-security/certificates
-log.Priority = DEBUG
-log.fileName = /var/glite/log/glite-lb-logger.log
+++ /dev/null
-#!/bin/sh
-# chkconfig: 345 76 24
-
-GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite}
-GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-$GLITE_LOCATION/var}
-
-[ -f /etc/glite.conf ] && . /etc/glite.conf
-[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf
-
-[ -f $GLITE_LOCATION/etc/lb.conf ] && . $GLITE_LOCATION/etc/lb.conf
-[ -f $GLITE_LOCATION_VAR/etc/lb.conf ] && . $GLITE_LOCATION_VAR/etc/lb.conf
-
-[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf
-
-unset creds port
-
-start()
-{
- case "$GLITE_LB_TYPE" in
- proxy)
- echo 'Not starting logd and interlogger, proxy only instance (GLITE_LB_TYPE=proxy).'
- return 0
- esac
-
- if test -z "$GLITE_USER" ;then
- echo 'Error: GLITE_USER is not set'
- echo FAILED
- return 1
- fi
-
- [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] &&
- creds="-c $GLITE_HOST_CERT -k $GLITE_HOST_KEY"
-
- if test -z "$creds"; then
- if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then
- echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER"
- creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem"
- fi
- fi
-
- [ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2
-
- [ -n "$GLITE_LB_LOGGER_PORT" ] && port="--port $GLITE_LB_LOGGER_PORT"
- [ -n "$GLITE_LB_IL_SOCK" ] && sock="--socket $GLITE_LB_IL_SOCK"
- [ -n "$GLITE_LB_IL_FPREFIX" ] && fprefix="--file-prefix $GLITE_LB_IL_FPREFIX"
-
- mkdir -p /var/glite/log
- chown $GLITE_USER /var/glite/log
- echo -n Starting glite-lb-logd ...
- (cd /tmp && ls -f /tmp |grep ^dglogd_sock_ |xargs rm -f)
- su - $GLITE_USER -c "$GLITE_LOCATION/bin/glite-lb-logd \
- $creds $port $sock $fprefix" && echo " done" || echo " FAILED"
-
- echo -n Starting glite-lb-interlogd ...
- su - $GLITE_USER -c "$GLITE_LOCATION/bin/glite-lb-interlogd \
- $creds $sock $fprefix" && echo " done" || echo " FAILED"
-}
-
-stop()
-{
- echo -n Stopping glite-lb-logd ...
- killall glite-lb-logd
- echo " done"
- echo -n Stopping glite-lb-interlogd ...
- killall glite-lb-interlogd
- echo " done"
-}
-
-status()
-{
- LC_ALL=C
- if netstat -an --inet | grep "^tcp .* 0.0.0.0:${GLITE_LB_LOGGER_PORT:-9002} .*LISTEN" >/dev/null 2>&1 ;then
- echo glite-lb-logd running
- else
- echo glite-lb-logd not running
- return 1
- fi
- if netstat -an --unix | grep "^unix .* LISTEN.* ${GLITE_LB_IL_SOCK:-/tmp/interlogger.sock}$" >/dev/null 2>&1 ;then
- echo glite-lb-interlogd running
- else
- echo glite-lb-interlogd not running
- return 1
- fi
-}
-
-case x$1 in
- xstart) start;;
- xstop) stop;;
- xrestart) stop; start;;
- xstatus) status;;
- x*) echo usage: $0 start,stop,restart,status >&2
- exit 1;;
-esac
+++ /dev/null
-#!/usr/bin/perl
-
-# WARNING: Don't edit this file unless it is the master copy in org.glite.lb
-#
-# For the purpose of standalone builds of lb/jobid/lbjp-common components
-# it is copied on tagging
-
-# $Header$
-
-use Getopt::Long;
-
-my $pwd = `pwd`; chomp $pwd;
-my $prefix = $pwd.'/stage';
-my $stagedir;
-my $staged;
-my $module;
-my $thrflavour = 'gcc64dbgpthr';
-my $nothrflavour = 'gcc64dbg';
-my $mode = 'build';
-my $help = 0;
-my $listmodules;
-my $version;
-my $output;
-my $lb_tag = '';
-my $lbjp_tag = '';
-my $jp_tag = '';
-my $sec_tag = '';
-my $jobid_tag = '';
-my $libdir = 'lib';
-
-my @nodes = qw/client server logger utils doc ws-test db jpprimary jpindex jpclient/;
-my %enable_nodes;
-my %disable_nodes;
-
-my %extern_prefix = (
- cares => '/opt/c-ares',
- classads => '/opt/classads',
- cppunit => '/usr',
- expat => '/usr',
- globus => '/opt/globus',
- jglobus => '/opt/globus',
- gsoap => '/usr',
- mysql => '/usr',
- 'mysql-devel' => '',
- 'mysql-server' => '',
- voms => '/opt/glite',
- gridsite => '/opt/glite',
- lcas => '/opt/glite',
- ant => '/usr',
- jdk => '/usr',
- libtar => '/usr',
-);
-
-my %jar = (
- 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar',
-);
-
-
-my %glite_prefix;
-my %need_externs;
-my %need_externs_type;
-my %need_jars;
-my %extrafull;
-my %extranodmod;
-my %deps;
-my %deps_type;
-my %topbuild;
-
-my %lbmodules = (
- 'lb' => [ qw/client common doc logger server state-machine types utils ws-interface ws-test glite-LB/],
- 'security' => [qw/gss gsoap-plugin/],
- 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/],
- 'jobid' => [qw/api-c api-cpp/],
- 'jp' => [ qw/client doc index primary server-common ws-interface/ ],
- );
-
-
-my @opts = (
- 'prefix=s' => \$prefix,
- 'staged=s' => \$staged,
- 'module=s' => \$module,
- 'thrflavour=s' => \$thrflavour,
- 'nothrflavour=s' => \$nothrflavour,
- 'mode=s' => \$mode,
- 'listmodules=s' => \$listmodules,
- 'version=s' => \$version,
- 'output=s' => \$output,
- 'stage=s' => \$stagedir,
- 'lb-tag=s' => \$lb_tag,
- 'lbjp-common-tag=s' => \$lbjp_tag,
- 'jp-tag=s' => \$jp_tag,
- 'security-tag=s' => \$sec_tag,
- 'jobid-tag=s' => \$jobid_tag,
- 'help' => \$help,
- 'libdir=s' => \$libdir,
-);
-
-for (@nodes) {
- $enable_nodes{$_} = 0;
- $disable_nodes{$_} = 0;
-
- push @opts,"disable-$_",\$disable_nodes{$_};
- push @opts,"enable-$_",\$enable_nodes{$_};
-}
-
-push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix;
-push @opts,"with-$_=s",\$jar{$_} for keys %jar;
-
-my @keeparg = @ARGV;
-
-GetOptions @opts or die "Errors parsing command line\n";
-
-$extern_prefix{'mysql-devel'}=$extern_prefix{mysql} if $extern_prefix{'mysql-devel'} eq '';
-$extern_prefix{'mysql-server'}=$extern_prefix{mysql} if $extern_prefix{'mysql-server'} eq '';
-
-if ($help) { usage(); exit 0; }
-
-if ($listmodules) {
- my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}};
- print "@m\n";
- exit 0;
-}
-
-warn "$0: --version and --output make sense only in --mode=etics\n"
- if ($version || $output) && $mode ne 'etics';
-
-my $en;
-for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; }
-
-my $dis;
-for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; }
-
-die "--enable-* and --disable-* are mutually exclusive\n"
- if $en && $dis;
-
-die "--module cannot be used with --enable-* or --disable-*\n"
- if $module && ($en || $dis);
-
-die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}};
-
-if ($dis) {
- for (@nodes) {
- $enable_nodes{$_} = 1 unless $disable_nodes{$_};
- }
-}
-
-if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ;
-
-for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; }
-
-$stagedir = $prefix unless $stagedir;
-
-if ($mode eq 'build') {
- print "Writing config.status\n";
- open CONF,">config.status" or die "config.status: $!\n";
- print CONF "$0 @keeparg\n";
- close CONF;
-}
-
-
-my @modules;
-my %aux;
-
-if ($module) {
-# push @modules,split(/[,.]+/,$module);
- push @modules,$module;
-}
-else {
- @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes));
-
- my $n;
-
- do {
- local $"="\n";
- $n = $#modules;
- push @modules,(map @{$deps{$_}},@modules);
-
- undef %aux; @aux{@modules} = (1) x ($#modules+1);
- @modules = keys %aux;
- } while ($#modules > $n);
-}
-
-@aux{@modules} = (1) x ($#modules+1);
-delete $aux{$_} for (split /,/,$staged);
-@modules = keys %aux;
-
-mode_build() if $mode eq 'build';
-mode_checkout() if $mode eq 'checkout';
-mode_etics($module) if $mode eq 'etics';
-
-sub mode_build {
- print "\nBuilding modules: @modules\n";
-
- my @ext = map @{$need_externs{$_}},@modules;
- my @myjars = map @{$need_jars{$_}},@modules;
- undef %aux; @aux{@ext} = 1;
- @ext = keys %aux;
- undef %aux; @aux{@myjars} = (1) x ($#myjars+1);
- @myjars = keys %aux;
-
- print "\nRequired externals:\n";
- print "\t$_: $extern_prefix{$_}\n" for @ext;
- print "\t$_: $jar{$_}\n" for @myjars;
- print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n";
-
- mkinc($_) for @modules;
-
- print "Creating Makefile\n";
-
- open MAK,">Makefile" or die "Makefile: $!\n";
-
- print MAK "all: @modules\n\nclean:\n";
-
- for (@modules) {
- my $full = full($_);
- my $build = $topbuild{$_} ? '': '/build';
- print MAK "\tcd $full$build && \${MAKE} clean\n"
- }
-
- print MAK "\ndistclean:\n";
-
- for (@modules) {
- my $full = full($_);
- print MAK $topbuild{$_} ?
- "\tcd $full$build && \${MAKE} distclean\n" :
- "\trm -rf $full$build\n"
- }
-
- print MAK "\n";
-
- for (@modules) {
- my %ldeps; undef %ldeps;
- @ldeps{@{$deps{$_}}} = 1;
- for my $x (split /,/,$staged) { delete $ldeps{$x}; }
- my @dnames = $module ? () : keys %ldeps;
-
- my $full = full($_);
- my $build = $topbuild{$_} ? '': '/build';
-
- print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n";
- }
-
- close MAK;
-}
-
-sub mode_checkout() {
- for (@modules) {
- my $module = $_;
- my $tag = "";
- if ($lb_tag){
- for (@{$lbmodules{lb}}){
- if ("lb.".$_ eq $module){
- $tag = '-r '.$lb_tag;
- }
- }
- }
- if ($lbjp_tag){
- for (@{$lbmodules{'lbjp-common'}}){
- if ("lbjp-common.".$_ eq $module){
- $tag = '-r '.$lbjp_tag;
- }
- }
- }
- if ($jp_tag){
- for (@{$lbmodules{'jp'}}){
- if ("jp.".$_ eq $module){
- $tag = '-r '.$jp_tag;
- }
- }
- }
- if ($sec_tag){
- for (@{$lbmodules{security}}){
- if ("security.".$_ eq $module){
- $tag = '-r '.$sec_tag;
- }
- }
- }
- if ($jobid_tag){
- for (@{$lbmodules{jobid}}){
- if ("jobid.".$_ eq $module){
- $tag = '-r '.$jobid_tag;
- }
- }
- }
- #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){
- # print "found";
- #}
- $_ = full($_);
- print "\n*** Checking out $_\n";
- system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n";
- }
-}
-
-BEGIN{
-%need_externs_aux = (
- 'lb.client' => [ qw/cppunit:B classads/ ],
- 'lb.client-java' => [ qw/ant:B jglobus jdk:B/ ],
- 'lb.common' => [ qw/expat cppunit:B classads/ ],
- 'lb.doc' => [],
- 'lb.logger' => [ qw/cppunit:B/ ],
- 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite/ ],
- 'lb.state-machine' => [ qw/classads/ ],
- 'lb.utils' => [ qw/cppunit:B/ ],
- 'lb.ws-interface' => [],
- 'lb.ws-test' => [ qw/gsoap:B/ ],
- 'lb.types' => [ qw// ],
- 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R yaim:R/ ],
- 'lbjp-common.db' => [ qw/mysql:R mysql-devel:B/ ],
- 'lbjp-common.maildir' => [ qw// ],
- 'lbjp-common.server-bones' => [ qw// ],
- 'lbjp-common.trio' => [ qw/cppunit:B/ ],
- 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ],
- 'security.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B/ ],
- 'security.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares gsoap:B/ ],
- 'jobid.api-c' => [ qw/cppunit:B/ ],
- 'jobid.api-cpp' => [ qw/cppunit:B/ ],
- 'jobid.api-java' => [ qw/ant:B jdk:B/ ],
- 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ],
- 'jp.doc' => [],
- 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ],
- 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ],
- 'jp.server-common' => [],
- 'jp.ws-interface' => [],
-);
-
-for my $ext (keys %need_externs_aux) {
- for (@{$need_externs_aux{$ext}}) {
- /([^:]*)(?::(.*))?/;
- push @{$need_externs{$ext}},$1;
- my $type = $2 ? $2 : 'BR';
- $need_externs_type{$ext}->{$1} = $type;
- }
-}
-
-%need_jars = (
- 'jobid.api-java' => [ qw/commons-codec/ ],
-);
-
-for my $jar (keys %need_jars) {
- for (@{$need_jars{$jar}}) {
- $need_externs_type{$jar}->{$_} = 'BR'; # XXX
- }
-}
-
-%deps_aux = (
- 'lb.client' => [ qw/
- lb.types:B lb.common
- lbjp-common.trio
- jobid.api-cpp:B jobid.api-c
- security.gss
- / ],
- 'lb.client-java' => [ qw/
- lb.types:B
- jobid.api-java
- / ],
- 'lb.common' => [ qw/
- jobid.api-cpp:B jobid.api-c
- lb.types:B lbjp-common.trio security.gss
- / ],
- 'lb.doc' => [ qw/lb.types:B/ ],
- 'lb.logger' => [ qw/
- lbjp-common.trio
- jobid.api-c
- lb.common
- security.gss
- / ],
- 'lb.server' => [ qw/
- lb.ws-interface lb.types:B lb.common lb.state-machine
- lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir
- jobid.api-c
- security.gsoap-plugin security.gss
- / ],
- 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface security.gss/ ],
- 'lb.utils' => [ qw/
- lbjp-common.jp-interface
- jobid.api-c
- lbjp-common.trio lbjp-common.maildir
- lb.client lb.state-machine
- / ],
- 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ],
- 'lb.ws-interface' => [ qw/lb.types:B/ ],
- 'lb.types' => [ qw// ],
- 'lb.glite-LB' => [ qw/
- lb.logger:R lb.server:R lb.utils:R lb.doc:R
- lb.ws-test:R
- / ],
- 'lbjp-common.db' => [ qw/lbjp-common.trio/ ],
- 'lbjp-common.maildir' => [ qw// ],
- 'lbjp-common.server-bones' => [ qw// ],
- 'lbjp-common.trio' => [ qw// ],
- 'security.gss' => [ qw// ],
- 'security.gsoap-plugin' => [ qw/security.gss/ ],
- 'jobid.api-c' => [ qw// ],
- 'jobid.api-cpp' => [ qw/jobid.api-c/ ],
- 'jobid.api-java' => [ qw// ],
-
- 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ],
-
- 'jp.client' => [ qw/
- jp.ws-interface
- lbjp-common.jp-interface lbjp-common.maildir
- jobid.api-c
- security.gsoap-plugin
- / ],
- 'jp.doc' => [ qw// ],
- 'jp.index' => [ qw/
- jp.server-common jp.ws-interface
- lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
- security.gsoap-plugin
- / ],
- 'jp.primary' => [ qw/
- jobid.api-c
- jp.server-common jp.ws-interface
- lb.state-machine
- lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
- security.gsoap-plugin
- / ],
- 'jp.server-common' => [ qw/
- lbjp-common.jp-interface lbjp-common.db
- / ],
- 'jp.ws-interface' => [ qw// ],
-);
-
-for my $ext (keys %deps_aux) {
- for (@{$deps_aux{$ext}}) {
- /([^:]*)(?::(.*))?/;
- push @{$deps{$ext}},$1;
- my $type = $2 ? $2 : 'BR';
- $deps_type{$ext}->{$1} = $type;
- }
-}
-
-
-%extrafull = ( gridsite=>'org.gridsite.core');
-
-#( java => 'client-java' );
-%extranodmod = (
- db => 'lbjp-common.db',
- jpprimary => 'jp.primary',
- jpindex => 'jp.index',
- jpclient => 'jp.client',
-);
-
-my @t = qw/lb.client-java jobid.api-java lb.types/;
-@topbuild{@t} = (1) x ($#t+1);
-}
-
-sub full
-{
- my $short = shift;
- return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short;
-}
-
-sub mkinc
-{
- my %aux;
- undef %aux;
- my @m=qw/
-lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java
-security.gss security.gsoap-plugin
-jobid.api-c jobid.api-cpp jobid.api-java
-lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface
-jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface
-/;
- @aux{@m} = (1) x ($#m+1);
-
- my $short = shift;
- my $full = full $short;
-
- unless ($aux{$short}) {
- print "Makefile.inc not needed in $full\n";
- return;
- }
-
- my $build = '';
-
- unless ($topbuild{$_}) {
- $build = '/build';
- unless (-d "$full/build") {
- mkdir "$full/build" or die "mkdir $full/build: $!\n";
- }
- unlink "$full/build/Makefile";
- symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n";
- }
-
- open MKINC,">$full$build/Makefile.inc"
- or die "$full$build/Makefile.inc: $!\n";
-
- print "Creating $full$build/Makefile.inc\n";
-
- print MKINC qq{
-PREFIX = $prefix
-stagedir = $stagedir
-thrflavour = $thrflavour
-nothrflavour = $nothrflavour
-libdir = $libdir
-};
-
- for (@{$need_externs{$short}}) {
- print MKINC "${_}_prefix = $extern_prefix{$_}\n"
- }
-
- for (@{$need_jars{$short}}) {
- print MKINC "${_}_jar = $jar{$_}\n"
- }
-
- my $need_gsoap = 0;
- for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; }
-
- print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap;
-
- close MKINC;
-}
-
-my %etics_externs;
-my %etics_projects;
-BEGIN{
- %etics_externs = (
- globus_essentials=>'vdt_globus_essentials',
- globus=>'globus',
- cares=>'c-ares',
- voms=>'org.glite.security.voms-api-cpp',
- gridsite=>'org.gridsite.shared',
- lcas=>'org.glite.security.lcas',
- trustmanager=>'org.glite.security.trustmanager',
- utiljava=>'org.glite.security.util-java',
- yaim=>'org.glite.yaim.lb',
- gpt=>'gpt',
- fetchcrl=>'fetch-crl',
- gip_release=>'glite-info-provider-release',
- gip_service=>'glite-info-provider-service',
- bdii=>'bdii',
- glite_version=>'glite-version',
- glite_info_templates=>'glite-info-templates',
- glue_schema=>'glue-schema',
- );
- %etics_projects = (
- vdt=>[qw/globus globus_essentials/],
- 'org.glite'=>[qw/voms gridsite lcas gpt gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim/],
- );
-};
-
-sub mode_etics {
- $fmod = shift;
-
- die "$0: --module required with --etics\n" unless $fmod;
-
- my ($subsys,$module) = split /\./,$fmod;
-
- my ($major,$minor,$rev,$age);
-
- if ($version) {
- $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/;
- ($major,$minor,$rev,$age) = ($1,$2,$3,$4);
- }
- else {
- open V,"org.glite.$subsys.$module/project/version.properties"
- or die "org.glite.$subsys.$module/project/version.properties: $!\n";
-
- while ($_ = <V>) {
- chomp;
- ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/;
- $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/;
- }
- close V;
- }
-
- my @copts = ();
- my %ge;
- @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1);
-
- for (@{$need_externs{"$subsys.$module"}}) {
- if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
- push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}";
- }
- }
-
- for (@{$need_jars{"$subsys.$module"}}) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
-
- push @copts,"--with-$_ \${$eext.location}/$_*.jar";
- }
-
-
- my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}";
- my $file = $output ? $output : "$conf.ini";
- open C,">$file" or die "$file: $!\n";
-
- my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n";
-
- my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..';
-
- print STDERR "Writing $file\n";
- print C qq{
-[Configuration-$conf]
-profile = None
-moduleName = org.glite.$subsys.$module
-displayName = $conf
-description = org.glite.$subsys.$module
-projectName = org.glite
-age = $age
-deploymentType = None
-tag = $conf
-version = $major.$minor.$rev
-path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz
-
-[Platform-default:VcsCommand]
-displayName = None
-description = None
-tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName}
-branch = None
-commit = None
-checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName}
-
-[Platform-default:BuildCommand]
-postpublish = None
-packaging = None
-displayName = None
-description = None
-doc = None
-prepublish = None
-publish = None
-compile = make
-init = None
-install = make install
-clean = make clean
-test = make check
-configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --libdir=\${libdir} --module $subsys.$module @copts
-checkstyle = None
-
-[Platform-default:Property]
-$buildroot
-
-[Platform-default:DynamicDependency]
-
-};
- for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
-
- my $proj = 'externals';
- for my $p (keys %etics_projects) {
- for $m (@{$etics_projects{$p}}) {
- $proj = $p if $m eq $_;
- }
- }
-
- my $type = $need_externs_type{"$subsys.$module"}->{$_};
- print C "$proj|$eext = $type\n";
- }
-
- for (@{$deps{"$subsys.$module"}}) {
- my $type = $deps_type{"$subsys.$module"}->{$_};
- print C "org.glite|org.glite.$_ = $type\n";
- }
-
- close C;
-}
-
-sub gsoap_version {
- local $_;
- my $gsoap_version;
- open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n";
-
- while ($_ = <S>) {
- chomp;
-
- $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/;
- }
- close S;
- return $gsoap_version;
-}
-
-
-sub usage {
- my @ext = keys %extern_prefix;
- my @myjars, keys %jar;
-
- print STDERR qq{
-usage: $0 options
-
-General options (defaults in []):
- --prefix=PREFIX destination directory [./stage]
- --staged=module,module,... what is already in PREFIX (specify without org.glite.)
- --thrflavour=flavour
- --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg]
- --listmodules=subsys list modules of a subsystem
- --libdir=libdir typically [lib,lib64] postfix
-
-Mode of operation:
- --mode={checkout|build|etics} what to do [build]
-
-What to build:
- --module=module build this module only (mostly in-Etics operation)
- --enable-NODE build this "node" (set of modules) only. Available nodes are
- @{$lbmodules{lb}},@{$lbmodules{security}}
- --disable-NODE don't build this node
- --lb-tag=tag checkout LB modules with specific tag
- --jp-tag=tag checkout JP modules with specific tag
- --lbjp-common-tag=tag checkout lbjp-common modules with specific tag
- --security-tag=tag checkout security modules with specific tag
- --jobid-tag=tag checkout jobid modules with specific tag
-
-Dependencies:
- --with-EXTERNAL=PATH where to look for an external. Required externals
- (not all for all modules) are:
- @ext
- --with-JAR=JAR where to look for jars. Required jars are:
- @myjars
- Summary of what will be used is always printed
-
-};
-
-}
+++ /dev/null
-.TH GLITE-LB-INTERLOGD 8 "April 2008" "EU EGEE Project" "Logging&Bookkeeping"
-
-.SH NAME
-glite-lb-interlogd - interlogger daemon
-
-.SH SYNOPSIS
-.B glite-lb-interlogd
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-.B glite-lb-interlogd
-takes over L&B events from glite-lb-logd and
-it is responsible for reliable transfer to their target storage -
-bookkeeping and logging servers.
-Interlogger maintains message queues for each target server
-and implements reliable handling in environment with possible communication
-failures.
-
-On startup (and then periodically during operation) interlogger checks the
-event files (created by glite-lb-logd, see also the -f option),
-spawns a thread for each target server, and populates the queues
-with events read from the files.
-Then it starts listening for further incoming events on the UNIX socket
-(see the -s option).
-
-The queue threads periodically attempt to contact the destination servers
-and to deliver the pending events.
-
-Eventually, when all events from a file are delivered the file is removed
-after a certain timeout by a clean-up thread.
-Possible race conditions wrt. glite-lb-logd are prevented by
-locking the files appropriately.
-
-.SH OPTIONS
-.TP
-.B "-b\fR,\fP --book
-Send events only to bookkeeping server. This option has effect only if
-the logging server address is specified through the -l option. There is no
-implementation of logging server currently.
-
-.TP
-.BI \-c " FILE" "\fR,\fP --cert " FILE
-Get certificate from
-.I FILE\fR.\fP
-This option overrides the
-.B \fR$\fPX509_USER_CERT
-environment variable.
-
-.TP
-.BI \-k " FILE" "\fR,\fP --key " FILE
-Get server private key from
-.I FILE\fR.\fP
-This option overrides the
-.B \fR$\fPX509_USER_KEY
-environment variable.
-
-.TP
-.BI \-C " DIR" "\fR,\fP --CAdir " DIR
-Look for trusted CA's certificates in
-.I DIR\fR.\fP
-This option overrides the
-.B \fR$\fPX509_CERT_DIR
-environment variable.
-
-.TP
-.B "-d\fR,\fP --debug"
-Don't run as daemon (do not fork and put itself into background).
-
-.TP
-.BI \-f " PREFIX" "\fR,\fP --file-prefix " PREFIX
-.I PREFIX
-is path prefix of the event files.
-
-For each job (jobid) a specific file is created that stores all events
-associated with this job.
-The job filename is constructed by stripping the
-protocol+server prefix from the jobid and appending the rest to this
-.I PREFIX.
-
-.I PREFIX
-defaults to /tmp/dglogd.log.
-
-On startup, interlogger checks all files matching the pattern
-.I PREFIX*.
-
-The value has to be same as used in the cooperating glite-lb-logd.
-
-.TP
-.BI \-k " FILE" "\fR,\fP --key " FILE
-Get private key from
-.I FILE\fR.\fP
-This option overrides the
-.B \fR$\fPX509_USER_KEY
-environment variable.
-
-.TP
-.BI -l " HOST" "\fR,\fP --log-server " HOST
-Use
-.I HOST
-as address of logging server.
-As the logging is not implemented yet this option should not be used.
-
-.TP
-.BI -s " PATH" "\fR,\fP --socket " PATH
-Listen for events sent by glite-lb-logd at the UNIX socket
-.I PATH.
-
-.TP
-.B "-v\fR,\fP --verbose"
-Print extensive debug output.
-
-.TP
-.B "-V\fR,\fP --version"
-Print version and exit.
-
-.TP
-.BI -L " TIMEOUT" "\fR,\fP --lazy " TIMEOUT
-Be lazy when closing connections to servers (default,
-.I TIMEOUT\fR
-==0 means turn lazy off).
-
-.TP
-.BI "-h\fR,\fP --help"
-Print help and exit.
-
-.\".SH USAGE
-.\" Add any additional description here
-
-.PP
-
-.SH FILES
-.TP
-.I /tmp/interlogger.sock
-Default name of local socket.
-.TP
-.I /tmp/dglogd.log*
-Default location of event files.
-
-.I /tmp/dglogd.log*.ctl
-Interlogger's control files keeping the information on status of
-the corresponding event file wrt. delivery to the target server.
-
-.TP
-No configuration files needed.
-
-.SH ENVIRONMENT
-.TP
-.B X509_USER_KEY
-If
-.B \fR$\fPX509_USER_KEY
-is set, it is used to locate private key file.
-
-.TP
-.B X509_USER_CERT
-If
-.B \fR$\fPX509_USER_CERT
-is set, it is used to locate certificate file.
-
-.TP
-.B X509_CERT_DIR
-If
-.B \fR$\fPX509_CERT_DIR
-is set, it is used to locate the trusted CA's certificates and ca-signing-policy files.
-
-.TP
-.B X509_USER_PROXY
-If
-.B \fR$\fPX509USER_PROXY
-is set, it is used to locate proxy certificate file.
-
-.SH REPORTING BUGS
-Please, report all bugs to EU EGEE Bug Tracking System located at https://savannah.cern.ch
-
-.SH SEE ALSO
-.B te-lb-bkserverd\fR(8),\fP glite-lb-logd\fR(8),\fP glite-lb-logevent\fR(1),\fP
-
-.SH AUTHOR
-EU EGEE, JRA1.
+++ /dev/null
-.TH GLITE-LB-LOGD 8 "April 2008" "EU EGEE Project" "Logging&Bookkeeping"
-
-.SH NAME
-glite-lb-logd - local logger daemon
-
-.SH SYNOPSIS
-.B glite-lb-logd
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-.B glite-lb-logd
-accepts the L&B events from their sources (via the producer L&B API).
-It is responsible for fast acceptance of the events and their reliable storage
-in local files.
-
-Under normal conditions, the events are forwared to the
-.B glite-lb-interlogd
-immediately.
-The file storage allows the interlogger crash recovery.
-
-.SH OPTIONS
-.TP
-.BI \-c " FILE" "\fR,\fP --cert " FILE
-Get certificate from
-.I FILE\fR.\fP
-This option overrides the
-.B \fR$\fPX509_USER_CERT
-environment variable.
-
-.TP
-.BI \-C " DIR" "\fR,\fP --CAdir " DIR
-Look for trusted CA's certificates in
-.I DIR\fR.\fP
-This option overrides the
-.B \fR$\fPX509_CERT_DIR
-environment variable.
-
-.TP
-.B "-d\fR,\fP --debug"
-Don't run as daemon, print additional diagnostics.
-
-.TP
-.B "-v\fR,\fP --verbose"
-Print extensive debug output.
-
-.TP
-.BI \-p " NUM" "\fR,\fP --port " NUM
-Listen on the port
-.I NUM\fR.\fP
-
-.TP
-.BI \-f " PREFIX" "\fR,\fP --file-prefix " PREFIX
-.I PREFIX
-is a path prefix of the event files.
-
-For each job (jobid) a specific file is created that stores all events
-associated with this job.
-The job filename is constructed by stripping the
-protocol+server prefix from the jobid and appending the rest to this
-.I PREFIX.
-
-.I PREFIX
-defaults to /tmp/dglogd.log.
-
-The value has to be same as used in the cooperating glite-lb-logd.
-
-.TP
-.BI \-k " FILE" "\fR,\fP --key " FILE
-Get private key from
-.I FILE\fR.\fP
-This option overrides the
-.B \fR$\fPX509_USER_KEY
-environment variable.
-
-
-.TP
-.BI -s " PATH" "\fR,\fP --socket " PATH
-Send the messages to interlogger through the UNIX socket
-.I PATH\fR.\fP
-
-The value has to be same as used in the cooperating glite-lb-interlogd.
-
-.TP
-.B "-V\fR,\fP --version"
-Print version and exit.
-
-.TP
-.B "-h\fR,\fP --help"
-Print help and exit.
-
-.TP
-.B --noAuth
-Don't require valid X509 credentials to run the daemon.
-Used for debugging only.
-
-.TP
-.B --noIPC
-Don't send messages to interlogger.
-
-.TP
-.B --noParse
-Don't parse messages for correctness.
-Dangerous, for debugging only! Don't use at all.
-
-
-.\".SH USAGE
-.\" Add any additional description here
-
-.PP
-
-.SH FILES
-.TP
-.I /tmp/interlogger.sock
-Default name of local socket.
-
-.TP
-.I /tmp/dglogd.log*
-Default location of the event storage files.
-.TP
-No configuration files needed.
-
-.SH ENVIRONMENT
-.TP
-.B X509_USER_KEY
-If
-.B \fR$\fPX509_USER_KEY
-is set, it is used to locate private key file.
-
-.TP
-.B X509_USER_CERT
-If
-.B \fR$\fPX509_USER_CERT
-is set, it is used to locate certificate file.
-
-.TP
-.B X509_CERT_DIR
-If
-.B \fR$\fPX509_CERT_DIR
-is set, it is used to locate the trusted CA's certificates and ca-signing-policy files.
-
-.TP
-.B X509_USER_PROXY
-If
-.B \fR$\fPX509USER_PROXY
-is set, it is used to locate proxy certificate file.
-
-
-.SH SIGNALS
-.TP
-.B USR1
-Increase verbosity of the program.
-
-.TP
-.B USR2
-Decrease verbosity of the program.
-
-
-.SH REPORTING BUGS
-Please, report all bugs to EGEE Bug Tracking System located at https://savannah.cern.ch
-
-.SH SEE ALSO
-.B glite-lb-bkserverd\fR(8),\fP glite-lb-interlogd\fR(8),\fP glite-lb-logevent\fR(1),\fP
-
-.SH AUTHOR
-EU EGEE, JRA1.
+++ /dev/null
-1.4.6-1 (lb-1.7.0-1)
-- let empty notification message get through the output queue to keep
- event_store commits in sync
-- don't keep event queue mutex while sleeping on error
-
-1.4.7-1 (lb-1.7.1-1)
-- support for message expiration
-
-1.4.8-1 (lb-1.7.2-1)
-- support for notification expiration
-
-1.4.9-1 (lb-1.7.3-1)
-- treat zero event expiration time as "never"
-
-1.4.9-2 (lb-1.7.4-1)
-- rebuild wrt. downgraded security 3.1.57-1
-
-1.4.9-3 (lb-1.8.0-1)
-- startup script: use grep with ^ rather than fgrep
-
-1.4.10-1
-- fixed sending empty events
-- do not syslog "error reading server reply" unnecessarily
-
-2.0.0-1
-- LB 2.0 release
-
-2.0.0-2
-- fixed configure to work in etics
-
-2.0.0-3
-- Fixed typos in the Makefile
-
-2.0.0-4
-- configure script update (globus flavors added to configure call)
-
-2.0.1-1
-- (from 1.4.11-1) Support chconfig in startup scripts (#27055)
-- (from 1.4.11-1) Proper kill signal handling (#36470)
-
-2.0.2-1
-- implemented multi-file event store, avoiding ever-growing files
- in the case of heavy traffic notifications
-
-2.0.3-1
-- Fixed handling messages with destination not set
-- Additional logging output
-
-2.0.4-1
-- Man page update
-
-2.0.4-2
-- install libraries into $libdir
-
-2.0.5-1
-- Starting proxy support
-
+++ /dev/null
-#Fri Aug 18 12:30:51 CEST 2006
-module.build=0243
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Configuration options for the GLite LB Client module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2006/03/15 18:25:31 akrenek
- cares
-
- Revision 1.2 2004/08/31 13:44:44 mvocu
- * added cppunit
-
- Revision 1.1 2004/07/07 12:08:47 akrenek
- *** empty log message ***
-
- Revision 1.2 2004/07/06 20:47:11 flammer
- Moved to configure.properties.xml
-
-
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="LB Client configuration options">
- <target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-cppunit_prefix=${with.cppunit.prefix}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
- </echo>
- </target>
- </project>
+++ /dev/null
-glite-lb-logger is the gLite LB local-logger and inter-logger. This package contains the local-logger (glite-lb-logd), inter-logger (glite-lb-interlogd) and notification inter-logger (glite-lb-notif-interlogd) daemons.
+++ /dev/null
-gLite Logging and Bookkeeping local-logger and inter-logger
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the Glite LB Logger component
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="LB Logger component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${lb.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${lb.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="logger" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-# $Header$
-module.version=2.0.5
-module.age=1
+++ /dev/null
-#ifndef _CONNECTION_H
-#define _CONNECTION_H
-
-
-class Connection {
-public:
- class Factory {
- public:
- virtual Connection *newConnection(int fd) const = 0;
- virtual Connection *accept(int fd) const = 0;
-
- virtual ~Factory() {}
- };
-
- class Endpoint {
- };
-
- Connection(int a_fd) : fd(a_fd)
- {}
-
- virtual ~Connection()
- {}
-
- virtual int getFD() const
- { return fd; }
-
- virtual int read(char *buf, unsigned int len) = 0;
- virtual int write(char *buf, unsigned int len) = 0;
-
-protected:
- int fd;
-};
-
-#endif
+++ /dev/null
-#include "Connection.H"
-
-Connection::Factory::~Factory() {
-}
+++ /dev/null
-#ifndef _EVENT_MANAGER_H
-#define _EVENT_MANAGER_H
-
-#include <list>
-
-
-// interface
-
-/**
- * Base class of event hierarchy.
- */
-class Event {
-public:
- virtual ~Event() {}
-};
-
-
-/**
- * Base class for event handler address.
- */
-class EventHandler {
-public:
- // constants for event handler return codes
- static const int NOT_HANDLED = 0;
- static const int HANDLED = 1;
- static const int HANDLED_FINAL = 2;
- static const int HANDLED_NEW = 3;
-
- virtual int handleEvent(Event* &e) { return NOT_HANDLED; }
- virtual ~EventHandler() {}
-};
-
-
-/**
- * Holds addres of event handler, ie. pointer to member function of T
- * that takes E* & as an argument.
- */
-template<class T, class E>
-class TypedEventHandler: public EventHandler {
-public:
- typedef int (T::*handlerType)(E* &);
-
- TypedEventHandler(T *handler, handlerType method)
- : m_handler(handler), m_handleEvent(method) {
- }
-
- virtual int handleEvent(Event* &e) {
- E *ne = dynamic_cast<E*>(e);
- int result = EventHandler::NOT_HANDLED;
- if(ne) {
- result = (m_handler->*m_handleEvent)(ne);
- if((result == EventHandler::HANDLED_NEW) &&
- !(ne == e)) {
- delete e;
- e = ne;
- }
- }
- return result;
- }
-
-private:
- T *m_handler;
- handlerType m_handleEvent;
-};
-
-
-class EventManager {
-public:
-
- int postEvent(Event* &event);
-
- template<class T, class E>
- EventHandler& registerHandler(T *handler, int (T::*method)(E* &)) {
- EventHandler *h = new TypedEventHandler<T,E>(handler, method);
- addHandler(h);
- return *h;
- }
-
- template<class T>
- EventHandler& registerHandler(T *handler) {
- return registerHandler(handler, &T::handleEvent);
- }
-
-private:
- std::list<EventHandler*> handlers;
-
- void addHandler(EventHandler*);
- void removeHandler(EventHandler *);
-};
-
-
-#endif
+++ /dev/null
-#include "EventManager.H"
-
-int
-EventManager::postEvent(Event* &e)
-{
- for(std::list<EventHandler*>::iterator i = handlers.begin();
- i != handlers.end();
- i++) {
- (*i)->handleEvent(e);
- }
- return 0;
-}
-
-void
-EventManager::addHandler(EventHandler *handler)
-{
- handlers.push_back(handler);
-}
-
-void
-EventManager::removeHandler(EventHandler *handler)
-{
-}
+++ /dev/null
-#ifndef _EXCEPTION_H
-#define _EXCEPTION_H
-
-class Exception {
-};
-
-class FatalException {
-};
-
-
-#define E_ASSERT(a) if(!(a)) { throw new FatalException; }
-
-#endif
+++ /dev/null
-#ifndef _HTTP_TRANSPORT_H
-#define _HTTP_TRANSPORT_H
-
-#include "ThreadPool.H"
-#include "Transport.H"
-#include "Singleton.H"
-
-#include <string>
-
-class HTTPTransport:
- public Transport
-{
-public:
-
- // factory class
- class Factory: public Transport::Factory,
- public Singleton<HTTPTransport::Factory> {
- public:
- virtual Transport *newTransport() const {
- return(new HTTPTransport());
- }
- };
-
- HTTPTransport()
- : Transport(),
- state(NONE),
- request(), headers(), body(NULL), pos(NULL),
- content_length(0)
- {}
-
- virtual ~HTTPTransport();
-
- virtual int receive(Connection *conn, Message* &msg);
- virtual int send(Connection *conn, Message* msg);
- virtual void reset();
-
-private:
- enum { NONE,
- IN_REQUEST,
- IN_HEADERS,
- IN_BODY } state;
- std::string request;
- std::string headers;
- char *body;
- char buffer[256];
- char *pos;
- unsigned int content_length;
-
- int parseHeader(const char *s, unsigned int len);
- void serializeHeaders(Message *msg);
-};
-
-
-#endif
+++ /dev/null
-#include "HTTPTransport.H"
-#include "Exception.H"
-#include "EventManager.H"
-
-#include <iostream>
-#include <string.h>
-
-
-HTTPTransport::~HTTPTransport()
-{
- if(body) free(body);
-}
-
-
-// read what is available and parse what can be parsed
-// returns the result of read operation of the underlying connection,
-// ie. the number of bytes read or error code
-int
-HTTPTransport::receive(Connection *conn, Message* &msg)
-{
- int len;
-
- switch(state) {
- case NONE:
- state = IN_REQUEST;
- pos = buffer;
-
- case IN_REQUEST:
- case IN_HEADERS:
- len = conn->read(pos, sizeof(buffer) - (pos - buffer));
- if(len < 0) {
- // error during request
- // state = NONE;
- return len;
- } else if(len == 0) {
- // other side closed connection
- // state = NONE;
- return len;
- } else {
- char *cr = NULL, *p = buffer, *s = buffer;
- bool crlf_seen = false;
-
- // parse buffer, look for CRLFs
- // s - start scan position
- // p - start of current token
- // cr - current CRLF position
- // crlf_seen <=> previous block ends with CRLF
- while((state != IN_BODY) &&
- (s < buffer + len) &&
- (cr = (char*)memchr(s, '\r', len - (s - buffer)))) {
- if((cr < buffer + len - 1) &&
- (cr[1] == '\n')) {
- // found CRLF
- if(state == IN_REQUEST) {
- // found end of request
- request.append(p, cr - p);
- // change state
- state = IN_HEADERS;
- // start new tokens
- p = cr + 2;
- } else {
- // headers continue. parse the current one
- *cr = 0;
- parseHeader(s, cr - s);
- *cr = '\r';
- }
- if(crlf_seen && (s == cr)) {
- // found CRLFCRLF
- state = IN_BODY;
- }
- // next scan starts after CRLF
- s = cr + 2;
- // we have seen CRLF
- crlf_seen = true;
- } else {
- if(crlf_seen && (s == cr)) {
- if(cr < buffer + len - 1) {
- // found CRLFCRx
- // continue scan behind this
- s = cr + 2;
- } else {
- // found CRLFCR at the end of buffer
- // s points behind buffer => scan ends
- s = cr + 1;
- // cr points at the CRLFCR => it will be left for next pass
- cr = cr - 2;
- }
- } else {
- // single '\r' - skip it,
- // or '\r' at the end of buffer - skip it, that ends scanning
- s = cr + 1;
- }
- crlf_seen = false;
- }
- }
- // copy the current token into appropriate variable,
- // but leave the trailing \r[\n] in buffer
- if(!cr) cr = buffer + len;
- if(state == IN_REQUEST)
- request.append(p, cr - p);
- else
- headers.append(p, cr - p);
- if(state == IN_BODY) {
- // we found body
- // content-length should be set at the moment
- if(content_length > 0) {
- body = (char*)malloc(content_length);
- if(body == NULL) {
- // chyba alokace
- }
- // move rest of buffer to body
- if(s < buffer + len) {
- memmove(body, s, buffer + len - s);
- pos = body + (buffer + len - s);
- } else {
- pos = body;
- }
- } else {
- // report error
- // XXX - this may happen, do not handle using exceptions
- std::cout << "Wrong content length" << std::endl;
- throw new Exception();
- }
- } else {
- // move the trailing characters to the front
- if(cr < buffer + len)
- memmove(buffer, cr, buffer + len - cr);
- // and set pos to point at the first free place
- pos = buffer + (buffer + len - cr);
- }
- }
- break;
-
- case IN_BODY:
- len = conn->read(pos, content_length - (pos - body));
- if(len < 0) {
- // error reading
- // state = NONE;
- return len;
- } else if(len == 0) {
- // no more data
- // state = NONE;
- return len;
- } else {
- pos += len;
- if(pos == content_length + body) {
- // finished reading
- state = NONE;
- }
- }
- break;
- }
-
- if(state != NONE)
- msg = NULL;
- else {
- // we have a new message
- // XXX - or we have an error, must handle it
- msg = new Message(body, content_length);
- msg->setProperties(
- }
- return len;
-}
-
-
-int
-HTTPTransport::parseHeader(const char *s, unsigned int len)
-{
- char *p;
-
- p = (char*)memccpy((void*)s, (void*)s, ':', len);
-
- if(!strncasecmp(s, "Content-Length", 14)) {
- content_length = p ? atoi(p) : 0 ;
- }
- return(0);
-}
-
-
-int
-HTTPTransport::send(Connection *conn, Message* msg)
-{
- int len;
- switch(state) {
- case NONE:
- state = IN_REQUEST;
- request = "POST " + msg->path() + "HTTP/1.1\r\n";
- pos = request.c_str();
- content_length = msg->getContent(body);
-
- case IN_REQUEST:
- len = conn->send(pos, request.length() - pos + request.c_str());
- if(len < 0) {
- return len;
- }
- pos += len;
- if(request.c_str() + request.length() == pos) {
- state = IN_HEADERS;
- prepareHeaders(msg);
- pos = headers.c_str();
- } else {
- break;
- }
-
- case IN_HEADERS:
- len = conn->send(pos, headers.length() - pos + headers.c_str());
- if(len < 0) {
- return len;
- }
- pos += len;
- if(headers.c_str() + headers.length() == pos) {
- state = IN_BODY;
- pos = body;
- } else {
- break;
- }
-
- case IN_BODY:
- len = conn->send(pos, body, content_length - pos + body);
- if(len < 0) {
- return len;
- }
- pos += len;
- if(body + content_length == pos) {
- state = NONE;
- return 0;
- }
- break;
-
- default:
- }
- return len;
-}
-
-
-void
-HTTPTransport::reset()
-{
- state = NONE;
- request.clear();
- headers.clear();
- if(body) {
- free(body);
- body = NULL;
- }
- content_length = 0;
- pos = buffer;
-}
-
-
-void
-HTTPTransport::serializeHeaders(Message *msg);
-{
- for(Properties::iterator i = msg->
-}
+++ /dev/null
-#ifndef _INPUT_CHANNEL_H_
-#define _INPUT_CHANNEL_H_
-
-#include "ThreadPool.H"
-#include "Connection.H"
-#include "Transport.H"
-
-class InputChannel
- : public ThreadPool::WorkDescription {
-public:
-
- InputChannel(Connection *conn, Transport *trans)
- : ThreadPool::WorkDescription(conn->getFD()),
- m_connection(conn), m_transport(trans)
- {}
-
- void start();
-
-protected:
- virtual void onReady();
- virtual void onTimeout();
- virtual void onError();
-
-private:
- Connection *m_connection;
- Transport *m_transport;
-};
-
-#endif
+++ /dev/null
-#include "InputChannel.H"
-#include "ThreadPool.H"
-#include "EventManager.H"
-
-extern EventManager theEventManager;
-
-void
-InputChannel::start()
-{
- ThreadPool::instance()->queueWorkRead(this);
-}
-
-void
-InputChannel::onReady()
-{
- Transport::Message *msg = NULL;
- int ret = m_transport->receive(m_connection, msg);
- if(ret <= 0) {
- // no new data read
- } else if(msg) {
- // we have a new message
-
- } else {
- // still need more data
- ThreadPool::instance()->queueWorkRead(this);
- }
-}
-
-void
-InputChannel::onTimeout()
-{
-}
-
-void
-InputChannel::onError()
-{
-}
+++ /dev/null
-
-CXX = c++
-CC = gcc
-
-CFLAGS = -g -Wall
-
-COMPILEPP = $(CXX) $(CXXFLAGS) $(CFLAGS)
-COMPILE = $(CC) $(CFLAGS)
-LINK = libtool --mode=link g++ $(LDFLAGS)
-
-THREAD_LIB = -lpthread
-
-CPPUNIT_ROOT =
-CPPUNIT_LIB = -lcppunit -ldl
-CPPUNIT_INCLUDE =
-
-TEST_OBJS= \
- test/ThreadPoolTest.o \
- test/PluginManagerTest.o \
- test/EventManagerTest.o \
- test/SingletonTest.o \
- test/test_main.o
-
-OBJS = \
- PluginManager.o \
- SocketInput.o \
- Connection.o \
- PlainConnection.o \
- Transport.o \
- HTTPTransport.o \
- ThreadPool.o \
- EventManager.o \
- InputChannel.cpp
-
-plain: main.o $(OBJS)
- $(LINK) -o $@ $+ $(THREAD_LIB)
-
-utest: ThreadPool.o PluginManager.o EventManager.o $(TEST_OBJS)
- $(LINK) -o $@ $+ $(CPPUNIT_LIB) $(THREAD_LIB)
-
-stest: EventManager.o test/EventManagerTest.o test/test_main.o
- $(LINK) -o $@ $+ $(CPPUNIT_LIB) $(THREAD_LIB)
-
-$(TEST_OBJS): %.o: %.cpp
- $(COMPILEPP) -I. $(CPPUNIT_INCLUDE) -o $@ -c $<
-
-%.o: %.cpp
- $(COMPILEPP) -o $@ -c $<
-
-%.o: %.c
- $(COMPILE) -o $@ -c $<
\ No newline at end of file
+++ /dev/null
-#ifndef _MESSAGE_H_
-#define _MESSAGE_H
-
-#include "Properties.H"
-#include "MessageStore.H"
-
-#include <string>
-
-class Message: public MessageStore::Storable {
-public:
-
- /** class that holds message state
- *
- */
- class State : public MessageStore::Storable {
- public:
-
- /** Get size needed for storage (from Storable).
- */
- virtual int getStorageSize() const;
-
- /** Save State (from Storable)
- */
- virtual int save(void* data, int len) const;
-
- /** Load State (from Storable)
- */
- virtual int load(void* data, int len);
- };
-
-
- Message();
-
- Message(void * data, unsigned int length)
- : m_length(length),
- m_data(data)
- {}
-
-
- int getContent(void* &data) const
- { data = m_data; return m_length; }
-
- int getContentLength() const
- { return m_length; }
-
- std::string getProperty(const std::string &name, std::string &val)
- { return m_properties.getProperty(name); }
-
- void setProperty(const std::string &name, std::string &val)
- { m_properties.setProperty(name, val); }
-
- Properties& getProperties()
- { return m_properties; }
-
- void setProperties(Properties &)
- {}
-
-private:
- MessageStore::ID m_id;
- unsigned int m_length;
- void * m_data;
- Properties m_properties;
-};
-
-
-#endif
+++ /dev/null
-#ifndef _MESSAGE_STORE_H_
-#define _MESSAGE_STORE_H_
-
-#include <pthread.h>
-
-/** Permanent storage for messages and their states.
- */
-
-class MessageStore {
-public:
-
- /** Base class for everything that can be stored here.
- */
- class Storable {
- public:
- /** Get size needed for object storage.
- */
- virtual int getStorageSize() const = 0;
-
- /** Save state of object into binary data.
- */
- virtual int save(void* data, int len) const = 0;
-
- /** Load state of object from binary data.
- */
- virtual int load(void* data, int len) = 0;
-
- virtual ~Storable() {}
- };
-
-
- /** Class that uniquely identifies stored content.
- */
- class ID: public Storable {
- public:
- /** Default constructor.
- *
- * Creates new unique ID.
- */
- ID();
-
- /** Copy constructor.
- */
- ID(const ID& src);
-
- /** Destructor.
- */
- ~ID() {};
-
- /** Assignment operator.
- */
- ID& operator=(const ID& src);
-
- /** Return the string suitable for printing.
- */
- std::string toString() const;
-
- /** Comparison operator
- */
- int operator==(const ID& second);
-
- /** Get size needed for storage (from Storable).
- */
- virtual int getStorageSize() const;
-
- /** Save ID (from Storable)
- */
- virtual int save(void* data, int len) const;
-
- /** Load ID (from Storable)
- */
- virtual int load(void* data, int len);
-
- protected:
- unsigned long long getID() {return id;}
-
- private:
- static pthread_mutex_t counterLock;
- static unsigned counter;
- unsigned long long id;
- };
-};
-
-#endif
+++ /dev/null
-#include <pthread.h>
-#include <sys/time.h>
-#include <sstream>
-
-#include "MessageStore.H"
-
-pthread_mutex_t MessageStore::ID::counterLock = PTHREAD_MUTEX_INITIALIZER;
-unsigned MessageStore::ID::counter = 0;
-
-MessageStore::ID::ID(){
- time_t t;
- time(&t);
- pthread_mutex_lock(&counterLock);
- counter++;
- id = ((unsigned long long) counter << 32) + t;
- pthread_mutex_unlock(&counterLock);
-}
-
-std::string MessageStore::ID::toString() const{
- std::ostringstream oss;
- oss << id;
- return oss.str();
-}
-
+++ /dev/null
-#ifndef _PLAIN_CONNECTION_H
-#define _PLAIN_CONNECTION_H
-
-#include "Connection.H"
-#include "Singleton.H"
-
-class PlainConnection:
- public Connection
-{
-public:
- class Factory: public Connection::Factory,
- public Singleton<PlainConnection::Factory> {
- public:
- virtual Connection *newConnection(int fd) const {
- return new PlainConnection(fd);
- }
-
- virtual Connection *accept(int fd) const;
-
- virtual ~Factory() {}
- };
-
- PlainConnection(int a_fd): Connection(a_fd)
- {}
-
- virtual ~PlainConnection();
-
- // from Connection
- virtual int read(char *buf, unsigned int len);
- virtual int write(char *buf, unsigned int len);
-
-};
-
-#endif
+++ /dev/null
-#include "PlainConnection.H"
-#include "ThreadPool.H"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-PlainConnection::~PlainConnection()
-{
-}
-
-
-Connection *
-PlainConnection::Factory::accept(int fd) const
-{
- int nfd;
-
- nfd = ::accept(fd, NULL, NULL);
- return newConnection(nfd);
-}
-
-
-int
-PlainConnection::read(char *buf, unsigned int len)
-{
- int ret;
-
- ret = ::recv(fd, buf, len, MSG_NOSIGNAL);
- return ret;
-}
-
-
-int
-PlainConnection::write(char *buf, unsigned int len)
-{
- int ret;
-
- ret = ::write(fd, buf, len);
- return ret;
-}
+++ /dev/null
-#ifndef _PLUGIN_MANAGER_H
-#define _PLUGIN_MANAGER_H
-
-#include <list>
-#include <iostream>
-
-#include "Singleton.H"
-
-class PluginManager: public Singleton<PluginManager> {
- friend class Singleton<PluginManager>;
-public:
-
- // base class for plugins
- class Plugin {
- public:
- const char *name;
-
- Plugin(const char *aname) : name(aname) {
- PluginManager::instance()->registerPlugin(this, aname);
- }
-
- virtual bool initialize() = 0;
- virtual bool cleanup () = 0;
-
- virtual ~Plugin();
- };
-
- // add plugin with given name to the list of registered plugins
- void registerPlugin(Plugin *plugin, const char *name) {
- pluginList.push_front(plugin);
- }
-
- // remove plugin from the list
- void removePlugin();
-
- // initialize all plugins on list
- void initialize() {
- for(std::list<Plugin *>::iterator i = pluginList.begin();
- i != pluginList.end();
- i++) {
- (*i)->initialize();
- }
-
- }
-
- // cleanup all plugins on list
- void cleanup() {
- for(std::list<Plugin *>::iterator i = pluginList.begin();
- i != pluginList.end();
- i++) {
- (*i)->cleanup();
- }
-
- }
-
-
-protected:
- // default constructor
- PluginManager() : pluginList()
- {};
-
-private:
- // list of registered plugins
- std::list<Plugin *> pluginList;
-
-};
-
-
-#endif
+++ /dev/null
-#include "PluginManager.H"
-
-PluginManager::Plugin::~Plugin() {
-}
-
-
+++ /dev/null
-#ifndef _PROPERTIES_H_
-#define _PROPERTIES_H_
-
-#include <map>
-#include <string>
-
-class Properties {
-public:
-
- // default constructor
- Properties()
- : properties()
- {}
-
- // accessors
- std::string& getProperty(const std::string &key)
- { return properties[key]; }
-
- void setProperty(const std::string &key, std::string &val)
- { properties[key] = val; }
-
- // iterators
- typedef std::map<std::string,std::string>::iterator iterator;
-
- iterator begin()
- { return properties.begin(); }
-
- iterator end()
- { return properties.end(); }
-
-
-private:
- std::map<std::string,std::string> properties;
-};
-
-#endif
+++ /dev/null
-#ifndef _SINGLETON_H
-#define _SINGLETON_H
-
-#include <pthread.h>
-
-#include "Exception.H"
-
-template <class T>
-class Singleton {
-public:
- // obtain the singleton object
- static T* instance() {
- // XXX - is this really thread safe?
- static pthread_mutex_t instance_lock = PTHREAD_MUTEX_INITIALIZER;
-
- pthread_mutex_lock(&instance_lock);
- if(theInstance == NULL) {
- theInstance = new T;
- }
- pthread_mutex_unlock(&instance_lock);
- return(theInstance);
- }
-
-protected:
- // prevent other's from messing with the instance
- Singleton() {}
- Singleton(const Singleton &) {}
- Singleton& operator=(const Singleton &) {}
- ~Singleton() {}
-
-private:
- static T *theInstance;
-};
-
-template<class T>
-T *Singleton<T>::theInstance = NULL;
-
-
-#endif
+++ /dev/null
-#ifndef _SOCKET_INPUT_H
-#define _SOCKET_INPUT_H
-
-#include "ThreadPool.H"
-#include "Connection.H"
-#include "Transport.H"
-
-#include "sys/un.h"
-
-
-class SocketInput: public ThreadPool::WorkDescription
-{
-public:
- SocketInput(const char *path,
- const Connection::Factory *a_cfactory,
- const Transport::Factory *a_tfactory);
- virtual ~SocketInput();
-
- // from WorkDescription
- virtual void onReady();
- virtual void onTimeout();
- virtual void onError();
-
-private:
- static const int SOCK_QUEUE_MAX = 5;
-
- struct sockaddr_un saddr;
- const Connection::Factory *cFactory;
- const Transport::Factory *tFactory;
-};
-
-#endif
+++ /dev/null
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <errno.h>
-
-#include "ThreadPool.H"
-#include "SocketInput.H"
-#include "InputChannel.H"
-#include "Exception.H"
-
-
-// create unix domain socket for input
-SocketInput::SocketInput(const char *path,
- const Connection::Factory *a_cfactory,
- const Transport::Factory *a_tfactory)
- : ThreadPool::WorkDescription(0),
- cFactory(a_cfactory),
- tFactory(a_tfactory)
-{
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, path);
- fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if(fd < 0) throw new Exception;
- if(connect(fd, (struct sockaddr*)&saddr, sizeof(saddr.sun_path)) < 0) {
- if(errno == ECONNREFUSED) {
- unlink(saddr.sun_path);
- }
- } else {
- // another instance running
- // throw new Exception
- }
- if(bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0)
- throw new Exception;
- if(listen(fd, SOCK_QUEUE_MAX) < 0)
- throw new Exception;
-}
-
-
-// remove the socket
-SocketInput::~SocketInput()
-{
- if(fd >= 0)
- close(fd);
- unlink(saddr.sun_path);
-}
-
-
-void
-SocketInput::onReady()
-{
- Connection *conn = cFactory->accept(fd);
- Transport *trans = tFactory->newTransport();
- InputChannel *channel = new InputChannel(conn, trans);
- channel->start();
-}
-
-
-void
-SocketInput::onTimeout()
-{
- // nothing special, just sit around
-}
-
-
-void
-SocketInput::onError()
-{
- // should report an error?
-}
+++ /dev/null
-#ifndef _THREAD_POOL_H
-#define _THREAD_POOL_H
-
-#include <pthread.h>
-#include <poll.h>
-#include <time.h>
-
-#include <list>
-
-#include "Singleton.H"
-
-class ThreadPool : public Singleton<ThreadPool> {
- friend class Singleton<ThreadPool>;
-public:
- const static int default_timeout = 5;
-
- class WorkDescription {
- friend class ThreadPool;
- public:
- int fd;
-
- WorkDescription(int afd)
- : fd(afd), event(NONE) {}
-
-
- virtual ~WorkDescription();
-
- protected:
- enum Event { NONE, READY, TIMEOUT, ERROR } event;
- void doWork();
-
- virtual void onReady()
- {}
-
- virtual void onTimeout()
- {}
-
- virtual void onError()
- {}
- };
-
-public:
- void startWorkers(unsigned int n);
- void stopWorkers();
-
- void postWork(WorkDescription *work_unit);
-
- void queueWorkAccept(WorkDescription *work_unit);
- void queueWorkRead(WorkDescription *work_unit);
- void queueWorkWrite(WorkDescription *work_unit);
- void queueWorkTimeout(WorkDescription *work_unit);
- void queueWorkConnect(WorkDescription *work_unit);
-
- void setWorkAccept(WorkDescription *work_unit);
- void setWorkRead(WorkDescription *work_unit);
- void setWorkWrite(WorkDescription *work_unit);
- void setWorkTimeout(WorkDescription *work_unit);
-
- void run();
- void exit()
- { f_exit = true; pthread_cond_signal(&wait_queue_cond_ready); }
-
-protected:
- ThreadPool();
- ~ThreadPool();
-
- WorkDescription *getWork();
-
-private:
- class WaitDesc {
- public:
- WorkDescription *wd;
- short event;
- bool f_permanent;
- struct timeval timeout;
-
- WaitDesc(WorkDescription *w, short e,
- bool permanent = false, int t = default_timeout)
- : wd(w), event(e), f_permanent(permanent) {
- timeout.tv_sec = t;
- timeout.tv_usec = 0;
- }
-
- int get_fd() { return wd->fd; };
- void adjustTimeout(const struct timeval &delta);
- int timeoutExpired() { return((timeout.tv_sec < 0) ||
- (timeout.tv_sec == 0 && timeout.tv_usec == 0)); }
- };
-
-private:
- bool f_exit;
- int num_workers;
- pthread_t *workers;
- int work_count;
- int wait_count;
- int ufds_size;
- std::list<WorkDescription *> work_queue;
- std::list<WaitDesc *> wait_queue;
- pthread_mutex_t work_queue_mutex;
- pthread_cond_t work_queue_cond_ready;
- pthread_cond_t work_queue_cond_full;
- pthread_mutex_t wait_queue_mutex;
- pthread_cond_t wait_queue_cond_ready;
- struct pollfd *ufds;
- int pd[2];
- struct timeval min_timeout;
-
- void prepareDescriptorArray();
- void removeWaitDesc(std::list<WaitDesc *>::iterator &i);
- void removeWorkDesc();
- void queueWork(WaitDesc *);
-
- static void *threadMain(void *);
- static void threadCleanup(void *);
-};
-
-#endif
+++ /dev/null
-#include <time.h>
-#include <pthread.h>
-#include <poll.h>
-#include <sys/time.h>
-#include <time.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <iostream>
-
-#include "ThreadPool.H"
-#include "Exception.H"
-
-
-static inline
-void
-tv_sub(struct timeval &a, const struct timeval &b) {
- a.tv_usec -= b.tv_usec;
- a.tv_sec -= b.tv_sec;
- if (a.tv_usec < 0) {
- a.tv_sec--;
- a.tv_usec += 1000000;
- }
-}
-
-
-static inline
-int
-tv_cmp(const struct timeval &a, const struct timeval &b) {
- if(a.tv_sec < b.tv_sec) {
- return -1;
- } else if(a.tv_sec > b.tv_sec) {
- return 1;
- } else {
- if (a.tv_usec < b.tv_usec) {
- return -1;
- } else if(a.tv_usec > b.tv_usec) {
- return 1;
- } else {
- return 0;
- }
- }
-}
-
-
-inline
-void
-ThreadPool::WorkDescription::doWork() {
- switch(event) {
- case READY:
- onReady();
- break;
- case TIMEOUT:
- onTimeout();
- break;
- case ERROR:
- onError();
- break;
- default:
- break;
- }
-}
-
-
-inline
-void
-ThreadPool::WaitDesc::adjustTimeout(const struct timeval &delta)
-{
- tv_sub(timeout, delta);
-}
-
-
-ThreadPool::WorkDescription::~WorkDescription() {
-}
-
-
-ThreadPool::ThreadPool()
- : f_exit(false), work_count(0), wait_count(0), ufds_size(0), ufds(NULL)
-{
- pthread_mutex_init(&wait_queue_mutex, NULL);
- pthread_mutex_init(&work_queue_mutex, NULL);
- pthread_cond_init(&work_queue_cond_ready, NULL);
- pthread_cond_init(&work_queue_cond_full, NULL);
- pthread_cond_init(&wait_queue_cond_ready, NULL);
- pipe(pd);
- ufds = static_cast<struct pollfd *>(malloc(sizeof(struct pollfd)));
- if(ufds == NULL) {
- throw new Exception;
- }
- ufds->fd = pd[0];
- ufds->events = POLLIN;
- ufds_size = 1;
-}
-
-
-ThreadPool::~ThreadPool()
-{
- pthread_cond_destroy(&work_queue_cond_full);
- pthread_cond_destroy(&work_queue_cond_ready);
- pthread_cond_destroy(&wait_queue_cond_ready);
- pthread_mutex_destroy(&work_queue_mutex);
- pthread_mutex_destroy(&wait_queue_mutex);
-}
-
-
-void
-ThreadPool::startWorkers(unsigned int n)
-{
- workers = new pthread_t[n];
-
- num_workers = n;
- for(unsigned int i = 0; i < n; i++) {
- // XXX check return
- pthread_create(&workers[i], NULL, ThreadPool::threadMain, NULL);
- }
-}
-
-
-void
-ThreadPool::stopWorkers()
-{
- for(int i = 0; i < num_workers; i++) {
- pthread_cancel(workers[i]);
- pthread_join(workers[i], NULL);
- }
- delete[] workers;
-}
-
-
-void
-ThreadPool::postWork(WorkDescription *work_unit)
-{
- E_ASSERT(pthread_mutex_lock(&work_queue_mutex) >= 0);
- work_queue.push_back(work_unit);
- work_count++;
- E_ASSERT(pthread_cond_signal(&work_queue_cond_ready) >= 0);
- E_ASSERT(pthread_mutex_unlock(&work_queue_mutex) >= 0);
-}
-
-
-inline
-void
-ThreadPool::queueWork(WaitDesc *wd)
-{
- E_ASSERT(pthread_mutex_lock(&wait_queue_mutex) >= 0);
- wait_queue.push_back(wd);
- wait_count++;
- E_ASSERT(pthread_cond_signal(&wait_queue_cond_ready) >= 0);
- E_ASSERT(pthread_mutex_unlock(&wait_queue_mutex) >= 0);
- if(write(pd[1], "1", 1) != 1) {
- throw new Exception;
- }
-}
-
-
-void
-ThreadPool::queueWorkAccept(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, POLLIN));
-}
-
-
-void
-ThreadPool::queueWorkRead(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, POLLIN));
-}
-
-
-void
-ThreadPool::queueWorkWrite(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, POLLOUT));
-}
-
-
-void
-ThreadPool::queueWorkTimeout(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, 0));
-}
-
-
-void
-ThreadPool::queueWorkConnect(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, POLLIN));
-}
-
-
-void
-ThreadPool::setWorkAccept(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, POLLIN, true));
-}
-
-
-void
-ThreadPool::setWorkRead(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, POLLIN, true));
-}
-
-
-void
-ThreadPool::setWorkWrite(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, POLLOUT, true));
-}
-
-
-void
-ThreadPool::setWorkTimeout(WorkDescription *work_unit)
-{
- queueWork(new WaitDesc(work_unit, 0, true));
-}
-
-
-ThreadPool::WorkDescription *
-ThreadPool::getWork()
-{
- WorkDescription *work_unit = NULL;
- struct timespec timeout;
-
- E_ASSERT(pthread_mutex_lock(&work_queue_mutex) >= 0);
- if(work_count == 0) {
- timeout.tv_sec = 1;
- timeout.tv_nsec = 0;
-// pthread_cond_timedwait(&work_queue_cond_ready, &work_queue_mutex, &timeout);
- E_ASSERT(pthread_cond_wait(&work_queue_cond_ready, &work_queue_mutex) == 0);
- }
- if(work_count > 0) {
- work_count--;
- work_unit = work_queue.front();
- work_queue.pop_front();
- }
- E_ASSERT(pthread_mutex_unlock(&work_queue_mutex) >= 0);
- return work_unit;
-}
-
-void
-ThreadPool::threadCleanup(void *data)
-{
- ThreadPool *pool = ThreadPool::instance();
-
- E_ASSERT(pthread_mutex_unlock(&(pool->work_queue_mutex)) >= 0);
-}
-
-
-void *
-ThreadPool::threadMain(void *data)
-{
- ThreadPool *pool = ThreadPool::instance();
- WorkDescription *work_unit;
-
- pthread_cleanup_push(ThreadPool::threadCleanup, NULL);
- while(true) {
-
- work_unit = pool->getWork();
- if(work_unit) {
- // something to work on
- work_unit->doWork();
- } else {
- // timed out waiting for work
- }
- }
- pthread_cleanup_pop(1);
-}
-
-
-void
-ThreadPool::removeWaitDesc(std::list<WaitDesc *>::iterator &i)
-{
- std::list<WaitDesc *>::iterator j = i;
-
- // actually this is safe even for the first element
- E_ASSERT(pthread_mutex_lock(&wait_queue_mutex) >= 0);
- j--;
- wait_queue.erase(i);
- wait_count--;
- i = j;
- E_ASSERT(pthread_mutex_unlock(&wait_queue_mutex) >= 0);
-}
-
-
-void
-ThreadPool::prepareDescriptorArray()
-{
- std::list<WaitDesc *>::iterator theIterator;
- struct pollfd *p;
-
- E_ASSERT(pthread_mutex_lock(&wait_queue_mutex) >= 0);
- if(wait_count == 0) {
- E_ASSERT(pthread_cond_wait(&wait_queue_cond_ready, &wait_queue_mutex) != 0);
- }
- if(wait_count == 0) {
- E_ASSERT(pthread_mutex_unlock(&wait_queue_mutex) >= 0);
- return;
- }
- if(ufds_size != wait_count + 1) {
- ufds = static_cast<struct pollfd *>(realloc(ufds, (1 + wait_count) * sizeof(struct pollfd)));
- if(ufds == NULL) {
- throw new Exception();
- }
- ufds_size = wait_count + 1;
- }
- min_timeout.tv_sec = default_timeout;
- min_timeout.tv_usec = 0;
- for(theIterator = wait_queue.begin(), p = ufds + 1;
- theIterator != wait_queue.end();
- theIterator++, p++) {
- WaitDesc *w = *theIterator;
- p->fd = w->get_fd();
- p->events = w->event;
- if(tv_cmp(min_timeout, w->timeout) > 0) {
- min_timeout = w->timeout;
- }
- }
- E_ASSERT(pthread_mutex_unlock(&wait_queue_mutex) >= 0);
-}
-
-
-void
-ThreadPool::run()
-{
- f_exit = false;
- while(!f_exit) {
- struct pollfd *p;
- struct timeval before, after;
- int ret;
-
- // may block waiting for new work
- prepareDescriptorArray();
-
- gettimeofday(&before, NULL);
- ret = poll(ufds, ufds_size, 1000*min_timeout.tv_sec + min_timeout.tv_usec/1000);
- gettimeofday(&after, NULL);
- tv_sub(after, before);
-
- if((ret >= 0) || // ready or timeout
- ((ret < 0) && (errno == EINTR))) { // interrupted
- std::list<WaitDesc *>::iterator i;
- WaitDesc *w;
-
- // handle the pipe
- if(ufds->revents & POLLIN) {
- char discard[1];
- read(ufds->fd, discard, 1);
- }
-
- // at least we have to adjust timeouts
- E_ASSERT(pthread_mutex_lock(&wait_queue_mutex) >= 0);
- i = wait_queue.begin();
- E_ASSERT(pthread_mutex_unlock(&wait_queue_mutex) >= 0);
- // the wait queue mutex is unlocked inside the loop
- // to allow handlers to add queue new
- // WorkDescriptions - these are added at the
- // end of the list so we should be safe
- for(p = ufds + 1; p - ufds < ufds_size; p++) {
- enum WorkDescription::Event event = WorkDescription::NONE;
-
- w = *i;
- // check for consistency
- if(p->fd != w->get_fd()) {
- // mismatch, what shall we do?
- throw new Exception;
- }
-
- // subtract the time passed from timeout
- w->adjustTimeout(after);
-
- // see what happened
- if(ret <= 0) {
- // timeout or interrupted
- if(w->timeoutExpired()) {
- event = WorkDescription::TIMEOUT;
- }
- } else {
- // ready or error
- if(p->revents & POLLERR) {
- event = WorkDescription::ERROR;
- } else if(p->revents & w->event) {
- event = WorkDescription::READY;
- } else if(w->timeoutExpired()) {
- event = WorkDescription::TIMEOUT;
- }
- }
- if(event != WorkDescription::NONE) {
- WorkDescription *wd;
- wd = w->wd;
- wd->event = event;
- if(!w->f_permanent) {
- postWork(wd);
- removeWaitDesc(i);
- delete w;
- } else {
- w->wd->doWork();
- // we have to reset the timeout
- w->timeout.tv_sec = default_timeout;
- w->timeout.tv_usec = 0;
- }
- }
- E_ASSERT(pthread_mutex_lock(&wait_queue_mutex) >= 0);
- i++;
- E_ASSERT(pthread_mutex_unlock(&wait_queue_mutex) >= 0);
- }
- } else {
- // some nasty error
- throw new Exception;
- }
- }
-}
-
+++ /dev/null
-#ifndef _TRANSPORT_H
-#define _TRANSPORT_H
-
-#include "Connection.H"
-#include "Message.H"
-
-// Transport implements transport protocol
-// - reads/writes messages using Connection interface
-// -
-class Transport {
-public:
-
- //
- class Factory {
- public:
- virtual Transport *newTransport() const = 0;
-
- virtual ~Factory()
- {}
- };
-
- //
- Transport()
- {}
-
- virtual ~Transport();
-
- //
- virtual int receive(Connection *conn, Message* &msg) = 0;
- virtual int send(Connection *conn, Message* msg) = 0;
- virtual void reset() = 0;
-};
-#endif
+++ /dev/null
-#include "Transport.H"
-
-Transport::~Transport()
-{
-}
+++ /dev/null
-#include "PluginManager.H"
-#include "ThreadPool.H"
-#include "SocketInput.H"
-#include "PlainConnection.H"
-#include "HTTPTransport.H"
-#include "EventManager.H"
-
-const int num_threads = 2;
-const char *sock_path = "/tmp/il_sock";
-
-EventManager theEventManager();
-
-int main(int argc, char *argv[])
-{
- SocketInput *input;
-
- // initialize plugins
- PluginManager::instance()->initialize();
-
- // create unix socket with plain IO and HTTP transport
- input = new SocketInput(sock_path,
- PlainConnection::Factory::instance(),
- HTTPTransport::Factory::instance());
- // and add the socket to pool
- ThreadPool::instance()->setWorkAccept(input);
-
- // start worker threads
- ThreadPool::instance()->startWorkers(num_threads);
-
- // run the main loop
- ThreadPool::instance()->run();
-
- // cleanup & exit
- delete input;
- PluginManager::instance()->cleanup();
-
- return 0;
-}
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "EventManager.H"
-
-class EventA : public Event {
-};
-
-class EventB : public Event {
-};
-
-class EventAA : public EventA {
-};
-
-
-class EventManagerTest: public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(EventManagerTest);
- CPPUNIT_TEST(handleEventTest);
- CPPUNIT_TEST_SUITE_END();
-public:
-
- void setUp() {
- handled = false;
- manager.registerHandler(this);
- }
-
- void tearDown() {
- }
-
- void handleEventTest() {
- Event *e = new EventAA();
- manager.postEvent(e);
- CPPUNIT_ASSERT(handled);
- }
-
- int handleEvent(EventA* &e) {
- handled = true;
- return 0;
- }
-
-private:
- EventManager manager;
- bool handled;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( EventManagerTest );
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "PluginManager.H"
-
-class TestPlugin : public PluginManager::Plugin {
-public:
- bool inited, cleaned;
-
- virtual bool initialize() {
- inited = true;
- }
-
- virtual bool cleanup() {
- cleaned = true;
- }
-
- static TestPlugin theTestPlugin;
-
-private:
- TestPlugin() : PluginManager::Plugin("test plugin"),
- inited(false),
- cleaned(false)
- {}
-
-
-
-};
-
-
-class PluginManagerTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(PluginManagerTest);
- CPPUNIT_TEST(testInit);
- CPPUNIT_TEST(testClean);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void setUp() {
- }
-
- void tearDown() {
- }
-
- void testInit() {
- PluginManager::instance()->initialize();
- CPPUNIT_ASSERT(TestPlugin::theTestPlugin.inited);
- }
-
- void testClean() {
- PluginManager::instance()->cleanup();
- CPPUNIT_ASSERT(TestPlugin::theTestPlugin.cleaned);
- }
-};
-
-
-TestPlugin TestPlugin::theTestPlugin;
-
-CPPUNIT_TEST_SUITE_REGISTRATION( PluginManagerTest );
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "Singleton.H"
-
-class one : public Singleton<one> {
- friend class Singleton<one>;
-};
-
-class two : public Singleton<two> {
- friend class Singleton<two>;
-};
-
-class SingletonTest: public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(SingletonTest);
- CPPUNIT_TEST(getInstance);
- CPPUNIT_TEST(pair);
- CPPUNIT_TEST(noCreate);
- CPPUNIT_TEST_SUITE_END();
-public:
-
- void setUp() {
- }
-
- void tearDown() {
- }
-
- void getInstance() {
- one *p;
- one *q;
-
- p = one::instance();
- q = one::instance();
- CPPUNIT_ASSERT(p != NULL);
- CPPUNIT_ASSERT(q != NULL);
- CPPUNIT_ASSERT(p == q);
- }
-
- void pair() {
- one *p;
- two *q;
-
- p = one::instance();
- q = two::instance();
- CPPUNIT_ASSERT(p != NULL);
- CPPUNIT_ASSERT(q != NULL);
- CPPUNIT_ASSERT((void*)p != (void*)q);
- }
-
- void noCreate() {
- one *p = new one;
-
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( SingletonTest );
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-
-#include <iostream>
-
-#include "ThreadPool.H"
-
-class TestWork : public ThreadPool::WorkDescription {
-public:
- int done;
-
- TestWork(int fd) : ThreadPool::WorkDescription(fd), done(0) {};
-
- virtual void onReady() {
- done++;
- }
-
-};
-
-
-class TestConsumer : public ThreadPool::WorkDescription {
-public:
- char buf[2];
-
- TestConsumer(int fd) : ThreadPool::WorkDescription(fd) {};
-
- virtual void onReady() {
- int r;
-
- r = read(fd, buf, 1);
- buf[1] = 0;
- ThreadPool::instance()->exit();
- }
-
- virtual void onTimeout() {
- }
-
-};
-
-
-class TestProducer : public ThreadPool::WorkDescription {
-public:
- TestProducer(int fd) : ThreadPool::WorkDescription(fd) {};
-
- virtual void onReady() {
- write(fd, "a", 1);
- }
-
- virtual void onTimeout() {
- }
-
-};
-
-
-class TestSocketRead: public ThreadPool::WorkDescription {
-public:
- char buffer[10];
-
- TestSocketRead(int fd) : ThreadPool::WorkDescription(fd) {
- }
-
- virtual void onReady() {
-
- int len = recv(fd, buffer, sizeof(buffer), MSG_NOSIGNAL);
- ThreadPool::instance()->exit();
- }
-
- virtual void onError() {
- }
-};
-
-
-class TestSocketWrite: public ThreadPool::WorkDescription {
-public:
- static char buffer[];
-
- TestSocketWrite(const char *name)
- : ThreadPool::WorkDescription(0) {
- struct sockaddr_un saddr;
- int ret;
- fd = socket(PF_UNIX, SOCK_STREAM, 0);
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, name);
- if((ret = connect(fd, (struct sockaddr *)&saddr, sizeof(saddr))) < 0) {
- }
- }
-
- virtual void onReady() {
- int ret;
-
- ret = send(fd, buffer, strlen(buffer)+1, MSG_NOSIGNAL);
- close(fd);
- }
-
-};
-
-char TestSocketWrite::buffer[] = "ahoj";
-
-class TestSocketAccept : public ThreadPool::WorkDescription {
-public:
- TestSocketRead *reader;
-
- TestSocketAccept(const char *name)
- : ThreadPool::WorkDescription(0) {
- struct sockaddr_un saddr;
-
- fd = socket(PF_UNIX, SOCK_STREAM, 0);
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, name);
- bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
- listen(fd, 1);
- }
-
- virtual void onReady() {
- int nfd;
-
- nfd = accept(fd, NULL, NULL);
- if(nfd < 0) {
- } else {
- ThreadPool *pool = ThreadPool::instance();
-
- reader = new TestSocketRead(nfd);
- pool->queueWorkRead(reader);
- }
- }
-};
-
-
-class ThreadPoolTest: public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE( ThreadPoolTest );
- CPPUNIT_TEST( testWorkQueue );
- CPPUNIT_TEST( testPoll );
- CPPUNIT_TEST( testAccept );
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void setUp() {
- pool = ThreadPool::instance();
- unlink("/tmp/smazat.sock");
- pool->startWorkers(2);
- }
-
- void tearDown() {
- pool->stopWorkers();
- }
-
- void testWorkQueue() {
- TestWork *work_unit = new TestWork(0);
- pool->postWork(work_unit);
- }
-
- void testPoll() {
- int fd[2];
- TestProducer *p = new TestProducer(0);
- TestConsumer *c = new TestConsumer(0);
-
- pipe(fd);
- c->fd = fd[0];
- p->fd = fd[1];
- pool->queueWorkRead(c);
- pool->queueWorkWrite(p);
- pool->run();
- CPPUNIT_ASSERT(c->buf[0] == 'a');
- CPPUNIT_ASSERT(c->buf[1] == 0);
- }
-
- void testAccept() {
- TestSocketAccept *consumer = new TestSocketAccept("/tmp/smazat.sock");
- TestSocketWrite *producer;
-
- pool->queueWorkAccept(consumer);
- producer = new TestSocketWrite("/tmp/smazat.sock");
- ThreadPool::instance()->queueWorkWrite(producer);
- pool->run();
- CPPUNIT_ASSERT(consumer->reader != NULL);
- CPPUNIT_ASSERT(strcmp(consumer->reader->buffer, TestSocketWrite::buffer) == 0);
- }
-
-private:
- ThreadPool *pool;
-};
-
-
-CPPUNIT_TEST_SUITE_REGISTRATION( ThreadPoolTest );
+++ /dev/null
-#include <assert.h>
-#include <fstream>
-
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/CompilerOutputter.h>
-//#include <cppunit/XmlOutputter.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TestResult.h>
-#include <cppunit/TestResultCollector.h>
-
-int main (int argc,const char *argv[])
-{
- CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-
-// assert(argc == 2);
-// std::ofstream xml(argv[1]);
-
- CppUnit::TestResult controller;
- CppUnit::TestResultCollector result;
- controller.addListener( &result );
-
- CppUnit::TestRunner runner;
- runner.addTest(suite);
- runner.run(controller);
-
-// CppUnit::XmlOutputter xout( &result, xml );
- CppUnit::CompilerOutputter tout( &result, std::cout);
-// xout.write();
- tout.write();
-
- return result.wasSuccessful() ? 0 : 1 ;
-}
+++ /dev/null
-#ident "$Header$"
-
-/*
- * - general queue handling routines (insert, get)
- */
-
-#include <netdb.h>
-#include <sys/socket.h>
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "glite/jobid/cjobid.h"
-
-#include "interlogd.h"
-
-struct event_queue_msg {
- struct server_msg *msg;
- struct event_queue_msg *prev;
-};
-
-struct event_queue *
-event_queue_create(char *server_name)
-{
- struct event_queue *eq;
- char *p;
-
- p = strchr(server_name, ':');
-
- if(p)
- *p++ = 0;
-
- if((eq = malloc(sizeof(*eq))) == NULL) {
- set_error(IL_NOMEM, ENOMEM, "event_queue_create: error allocating event queue");
- return(NULL);
- }
-
- memset(eq, 0, sizeof(*eq));
-
- eq->dest_name = strdup(server_name);
-
- if(p)
- *(p-1) = ':';
-
-#if defined(IL_NOTIFICATIONS) || defined(IL_WS)
- eq->dest_port = atoi(p);
-#else
- eq->dest_port = p ? atoi(p)+1 : GLITE_JOBID_DEFAULT_PORT+1;
-#endif
- /* create all necessary locks */
- if(pthread_rwlock_init(&eq->update_lock, NULL)) {
- set_error(IL_SYS, errno, "event_queue_create: error creating update lock");
- free(eq);
- return(NULL);
- }
- if(pthread_mutex_init(&eq->cond_lock, NULL)) {
- set_error(IL_SYS, errno, "event_queue_create: error creating cond mutex");
- free(eq);
- return(NULL);
- }
- if(pthread_cond_init(&eq->ready_cond, NULL)) {
- set_error(IL_SYS, errno, "event_queue_create: error creating cond variable");
- free(eq);
- return(NULL);
- }
-
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
- if(pthread_cond_init(&eq->flush_cond, NULL)) {
- set_error(IL_SYS, errno, "event_queue_create: error creating cond variable");
- free(eq);
- return(NULL);
- }
-#endif
-
- return(eq);
-}
-
-
-int
-event_queue_free(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(!event_queue_empty(eq))
- return(-1);
-
- if(eq->thread_id)
- pthread_cancel(eq->thread_id);
-
-
- pthread_rwlock_destroy(&eq->update_lock);
- pthread_mutex_destroy(&eq->cond_lock);
- pthread_cond_destroy(&eq->ready_cond);
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
- pthread_cond_destroy(&eq->flush_cond);
-#endif
- free(eq);
-
- return(0);
-}
-
-
-int
-event_queue_empty(struct event_queue *eq)
-{
- int ret;
-
- assert(eq != NULL);
-
- event_queue_lock_ro(eq);
- ret = (eq->head == NULL);
- event_queue_unlock(eq);
-
- return(ret);
-}
-
-
-int
-event_queue_insert(struct event_queue *eq, struct server_msg *msg)
-{
- struct event_queue_msg *el;
-#if defined(INTERLOGD_EMS)
- struct event_queue_msg *tail;
-#endif
-
- assert(eq != NULL);
-
- if((el = malloc(sizeof(*el))) == NULL)
- return(set_error(IL_NOMEM, ENOMEM, "event_queue_insert: not enough room for queue element"));
-
- el->msg = server_msg_copy(msg);
- if(el->msg == NULL) {
- free(el);
- return(-1);
- };
-
- /* this is critical section */
- event_queue_lock(eq);
-#if defined(INTERLOGD_EMS)
- if(server_msg_is_priority(msg)) {
- /* priority messages go first */
- tail = eq->tail_ems;
- if(tail) {
- el->prev = tail->prev;
- tail->prev = el;
- if (tail == eq->tail)
- eq->tail = el;
- } else {
- el->prev = eq->head;
- eq->head = el;
- if(eq->tail == NULL)
- eq->tail = el;
- }
- eq->tail_ems = el;
- } else
-#endif
- {
- /* normal messages */
- if(eq->tail)
- eq->tail->prev = el;
- else
- eq->head = el;
- eq->tail = el;
- el->prev = NULL;
- }
-#if defined(INTERLOGD_EMS)
- /* if we are inserting message between mark_prev and mark_this,
- we have to adjust mark_prev accordingly */
- if(eq->mark_this && (el->prev == eq->mark_this))
- eq->mark_prev = el;
-#endif
-
- if(++eq->cur_len > eq->max_len)
- eq->max_len = eq->cur_len;
-
- event_queue_unlock(eq);
- /* end of critical section */
-
- return(0);
-}
-
-
-int
-event_queue_get(struct event_queue *eq, struct server_msg **msg)
-{
- struct event_queue_msg *el;
-
- assert(eq != NULL);
- assert(msg != NULL);
-
- event_queue_lock(eq);
- el = eq->head;
-#if defined(INTERLOGD_EMS)
- /* this message is marked for removal, it is first on the queue */
- eq->mark_this = el;
- eq->mark_prev = NULL;
-#endif
- event_queue_unlock(eq);
-
- if(el == NULL)
- return(-1);
-
- *msg = el->msg;
-
- return(0);
-}
-
-
-int
-event_queue_remove(struct event_queue *eq)
-{
- struct event_queue_msg *el;
-#if defined(INTERLOGD_EMS)
- struct event_queue_msg *prev;
-#endif
-
- assert(eq != NULL);
-
- /* this is critical section */
- event_queue_lock(eq);
-#if defined(INTERLOGD_EMS)
- el = eq->mark_this;
- prev = eq->mark_prev;
-
- if(el == NULL) {
- event_queue_unlock(eq);
- return(-1);
- }
-
- if(prev == NULL) {
- /* removing from head of the queue */
- eq->head = el->prev;
- } else {
- /* removing from middle of the queue */
- prev->prev = el->prev;
- }
- if(el == eq->tail) {
- /* we are removing the last message */
- eq->tail = prev;
- }
- if(el == eq->tail_ems) {
- /* we are removing last priority message */
- eq->tail_ems = prev;
- }
-
- eq->mark_this = NULL;
- eq->mark_prev = NULL;
-#else
- el = eq->head;
- if(el == NULL) {
- event_queue_unlock(eq);
- return(-1);
- }
- eq->head = el->prev;
- if(el == eq->tail) {
- eq->tail = NULL;
- }
-#endif
- if(--eq->cur_len == 0)
- eq->times_empty++;
-
- event_queue_unlock(eq);
- /* end of critical section */
-
- server_msg_free(el->msg);
- free(el);
-
- return(0);
-}
-
-int
-event_queue_move_events(struct event_queue *eq_s,
- struct event_queue *eq_d,
- int (*cmp_func)(struct server_msg *, void *),
- void *data)
-{
- struct event_queue_msg *p, **source_prev, **dest_tail;
-
- assert(eq_s != NULL);
-
- event_queue_lock(eq_s);
- if(eq_d) {
- event_queue_lock(eq_d);
- /* dest tail is set to point to the last (NULL) pointer in the list */
- dest_tail = (eq_d->head == NULL) ? &(eq_d->head) : &(eq_d->tail->prev);
- }
- source_prev = &(eq_s->head);
- p = *source_prev;
- eq_s->tail = NULL;
- while(p) {
- if((*cmp_func)(p->msg, data)) {
- il_log(LOG_DEBUG, " moving event at offset %d(%d) from %s:%d to %s:%d\n",
- p->msg->offset, p->msg->generation, eq_s->dest_name, eq_s->dest_port,
- eq_d ? eq_d->dest_name : "trash", eq_d ? eq_d->dest_port : -1);
- /* il_log(LOG_DEBUG, " current: %x, next: %x\n", p, p->prev); */
- /* remove the message from the source list */
- *source_prev = p->prev;
- if(eq_d) {
- /* append the message at the end of destination list */
- p->prev = NULL;
- *dest_tail = p;
- dest_tail = &(p->prev);
- eq_d->tail = p;
- } else {
- /* signal that the message was 'delivered' */
- event_store_commit(p->msg->es, p->msg->ev_len, queue_list_is_log(eq_s),
- p->msg->generation);
- /* free the message */
- server_msg_free(p->msg);
- free(p);
- }
- } else {
- /* message stays */
- source_prev = &(p->prev);
- eq_s->tail = p;
- }
- p = *source_prev;
- }
- if(eq_d) event_queue_unlock(eq_d);
- event_queue_unlock(eq_s);
- return(0);
-}
-
+++ /dev/null
-#ident "$Header$"
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <sys/param.h>
-
-#include "glite/lb/events_parse.h"
-
-#include "interlogd.h"
-
-#ifdef __GNUC__
-#define UNUSED_VAR __attribute__((unused))
-#else
-#define UNUSED_VAR
-#endif
-
-static char *file_prefix = NULL;
-
-
-struct event_store_list {
- struct event_store *es;
- struct event_store_list *next; // LL of event_store's
- struct event_store_list *jobid_next; /* double LL of rotated stores - forward */
- struct event_store_list *jobid_prev; /* double LL of rotated stores - backward */
-};
-
-
-static struct event_store_list *store_list;
-static pthread_rwlock_t store_list_lock = PTHREAD_RWLOCK_INITIALIZER;
-
-
-/* ----------------
- * helper functions
- * ----------------
- */
-static
-char *
-astrcat(const char *s1, const char *s2)
-{
- char *s = malloc(strlen(s1) + strlen(s2) + 1);
- if(s == NULL)
- return NULL;
- *s = 0;
- strcat(s, s1);
- strcat(s, s2);
- return s;
-}
-
-
-static
-char *
-jobid2eventfile(IL_EVENT_ID_T job_id)
-{
- char *buffer;
- char *hash;
-
- if(job_id) {
- hash = IL_EVENT_GET_UNIQUE(job_id);
- asprintf(&buffer, "%s.%s", file_prefix, hash);
- free(hash);
- } else
- asprintf(&buffer, "%s.default", file_prefix);
-
- return(buffer);
-}
-
-
-static
-char *
-jobid2controlfile(IL_EVENT_ID_T job_id)
-{
- char buffer[256];
- char *hash;
-
- if(job_id) {
- hash = IL_EVENT_GET_UNIQUE(job_id);
- snprintf(buffer, 256, "%s.%s.ctl", file_prefix, hash);
- free(hash);
- } else
- snprintf(buffer, 256, "%s.default.ctl", file_prefix);
-
- return(strdup(buffer));
-}
-
-static
-long long
-fname2index(const char *filename)
-{
- char *p = rindex(filename, '.');
- char *s;
- long long ret;
-
- if(p == NULL)
- return 0;
-
- for(s = p+1; *s != 0; s++) {
- if(*s < '0' || *s > '9') {
- return 0;
- }
- }
-
- sscanf(p+1,"%lld",&ret);
- return ret+1;
-}
-
-
-static
-char *
-read_event_string(FILE *file)
-{
- char *buffer, *p, *n;
- int len, c;
-
- buffer=malloc(1024);
- if(buffer == NULL) {
- set_error(IL_NOMEM, ENOMEM, "read_event_string: no room for event");
- return(NULL);
- }
- p = buffer;
- len = 1024;
-
- while((c=fgetc(file)) != EOF) {
-
- /* we have to have free room for one byte */
- /* if(len - (p - buffer) < 1) */
- if(p - buffer >= len) {
- n = realloc(buffer, len + 8192);
- if(n == NULL) {
- free(buffer);
- set_error(IL_NOMEM, ENOMEM, "read_event_string: no room for event");
- return(NULL);
- }
- p = p - buffer + n;
- buffer = n;
- len += 8192;
- }
-
- if(c == EVENT_SEPARATOR) {
- *p++ = 0;
- break;
- } else
- *p++ = (char) c;
- }
-
- if(c != EVENT_SEPARATOR) {
- free(buffer);
- return(NULL);
- }
-
- return(buffer);
-}
-
-
-
-/* ------------------------------
- * event_store 'member' functions
- * ------------------------------
- */
-static
-int
-event_store_free(struct event_store *es)
-{
- assert(es != NULL);
-
- if(es->job_id_s) free(es->job_id_s);
- if(es->event_file_name) free(es->event_file_name);
- if(es->control_file_name) free(es->control_file_name);
- pthread_rwlock_destroy(&es->use_lock);
- pthread_rwlock_destroy(&es->commit_lock);
- pthread_rwlock_destroy(&es->offset_lock);
- free(es);
-
- return(0);
-}
-
-
-static
-struct event_store *
-event_store_create(char *job_id_s, const char *filename)
-{
- struct event_store *es;
- IL_EVENT_ID_T job_id;
-
- es = malloc(sizeof(*es));
- if(es == NULL) {
- set_error(IL_NOMEM, ENOMEM, "event_store_create: error allocating room for structure");
- return(NULL);
- }
-
- memset(es, 0, sizeof(*es));
-
- job_id = NULL;
- if(strcmp(job_id_s, "default") && IL_EVENT_ID_PARSE(job_id_s, &job_id)) {
- set_error(IL_LBAPI, EDG_WLL_ERROR_PARSE_BROKEN_ULM, "event_store_create: error parsing id");
- free(es);
- return(NULL);
- }
-
- es->job_id_s = strdup(job_id_s);
- es->event_file_name = filename ? strdup(filename) : jobid2eventfile(job_id);
- es->control_file_name = filename ? astrcat(filename, ".ctl") : jobid2controlfile(job_id);
- es->rotate_index = filename ? fname2index(filename) : 0;
- IL_EVENT_ID_FREE(job_id);
-
- il_log(LOG_DEBUG, " creating event store for id %s, filename %s, rotate index %lld\n",
- job_id_s, es->event_file_name, es->rotate_index);
-
- if(pthread_rwlock_init(&es->commit_lock, NULL))
- abort();
- if(pthread_rwlock_init(&es->offset_lock, NULL))
- abort();
- if(pthread_rwlock_init(&es->use_lock, NULL))
- abort();
-
- return(es);
-}
-
-
-static
-int
-event_store_lock_ro(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_rdlock(&es->commit_lock))
- abort();
-
- return(0);
-}
-
-
-static
-int
-event_store_lock(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_wrlock(&es->commit_lock))
- abort();
-
- return(0);
-}
-
-
-static
-int
-event_store_unlock(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_unlock(&es->commit_lock))
- abort();
- return(0);
-}
-
-
-static
-int
-event_store_read_ctl(struct event_store *es)
-{
- FILE *ctl_file;
-
- assert(es != NULL);
-
- event_store_lock(es);
- if((ctl_file = fopen(es->control_file_name, "r")) == NULL) {
- /* no control file, new event file */
- es->last_committed_ls = 0;
- es->last_committed_bs = 0;
- } else {
- /* read last seen and last committed counts */
- fscanf(ctl_file, "%*s\n%ld\n%ld\n",
- &es->last_committed_ls,
- &es->last_committed_bs);
- fclose(ctl_file);
- }
- event_store_unlock(es);
-
- return(0);
-}
-
-
-static
-int
-event_store_write_ctl(struct event_store *es)
-{
- FILE *ctl;
-
- assert(es != NULL);
-
- ctl = fopen(es->control_file_name, "w");
- if(ctl == NULL) {
- set_error(IL_SYS, errno, "event_store_write_ctl: error opening control file");
- return(-1);
- }
-
- if(fprintf(ctl, "%s\n%ld\n%ld\n",
- es->job_id_s,
- es->last_committed_ls,
- es->last_committed_bs) < 0) {
- set_error(IL_SYS, errno, "event_store_write_ctl: error writing control record");
- return(-1);
- }
-
- if(fclose(ctl) < 0) {
- set_error(IL_SYS, errno, "event_store_write_ctl: error closing control file");
- return(-1);
- }
-
- return(0);
-}
-
-
-/*
- * event_store_qurantine()
- * - rename damaged event store file
- * - essentially does the same actions as cleanup, but the event store
- * does not have to be empty
- * returns 0 on success, -1 on error
- */
-static
-int
-event_store_quarantine(struct event_store *es)
-{
- // TODO enable cleanup of quarantined event_store struct
- // TODO handle file rotation
-
- int num;
- char newname[MAXPATHLEN+1];
-
- /* find available quarantine name */
- /* we give it at most 1024 tries */
- for(num = 0; num < 1024; num++) {
- struct stat st;
-
- snprintf(newname, MAXPATHLEN, "%s.quarantine.%d", es->event_file_name, num);
- newname[MAXPATHLEN] = 0;
- if(stat(newname, &st) < 0) {
- if(errno == ENOENT) {
- /* file not found */
- break;
- } else {
- /* some other error with name, probably permanent */
- set_error(IL_SYS, errno, "event_store_qurantine: error looking for quarantine filename");
- return(-1);
-
- }
- } else {
- /* the filename is used already */
- }
- }
- if(num >= 1024) {
- /* new name not found */
- /* XXX - is there more suitable error? */
- set_error(IL_SYS, ENOSPC, "event_store_quarantine: exhausted number of retries looking for quarantine filename");
- return(-1);
- }
-
- /* actually rename the file */
- il_log(LOG_DEBUG, " renaming damaged event file from %s to %s\n",
- es->event_file_name, newname);
- if(rename(es->event_file_name, newname) < 0) {
- set_error(IL_SYS, errno, "event_store_quarantine: error renaming event file");
- return(-1);
- }
-
- /* clear the counters */
- es->last_committed_ls = 0;
- es->last_committed_bs = 0;
- es->offset = 0;
-
- /* increase cleanup count, this will invalidate all commits from previous generation */
- es->generation++;
-
- return(0);
-}
-
-
-/*
- * event_store_rotate_file()
- * returns 0 on success, -1 on error
- */
-static
-int
-event_store_rotate_file(struct event_store *es)
-{
- int num;
- time_t timestamp = time(NULL);
- char newname[MAXPATHLEN+1];
-
- /* do not rotate already rotated files */
- if(es->rotate_index > 0)
- return 0;
-
- /* find available name */
- /* we give it at most 256 tries */
- for(num = 0; num < 256; num++) {
- struct stat st;
-
- snprintf(newname, MAXPATHLEN, "%s.%d%03d", es->event_file_name, timestamp, num);
- newname[MAXPATHLEN] = 0;
- if(stat(newname, &st) < 0) {
- if(errno == ENOENT) {
- /* file not found */
- break;
- } else {
- /* some other error with name, probably permanent */
- set_error(IL_SYS, errno, "event_store_rotate_file: error looking for available filename");
- return(-1);
-
- }
- } else {
- /* the filename is used already */
- }
- }
- if(num >= 1024) {
- /* new name not found */
- /* XXX - is there more suitable error? */
- set_error(IL_SYS, ENOSPC, "event_store_quarantine: exhausted number of retries looking for quarantine filename");
- return(-1);
- }
-
- /* actually rename the file */
- il_log(LOG_DEBUG, " renaming too large event file from %s to %s\n",
- es->event_file_name, newname);
- if(rename(es->event_file_name, newname) < 0) {
- set_error(IL_SYS, errno, "event_store_rotate_file: error renaming event file");
- return(-1);
- }
-
- /* change names in event_store */
- es->event_file_name = strdup(newname);
- es->control_file_name = astrcat(newname, ".ctl");
- es->rotate_index = 1000*timestamp + num + 1;
-
- return(0);
-}
-
-
-/*
- * event_store_recover_jobid()
- * - recover all event stores for given jobid
- */
-static
-int
-event_store_recover_jobid(struct event_store *es)
-{
- // es is locked for use already
- struct event_store_list *p = es->le;
-
- do {
- event_store_recover(p->es);
- if(p != es->le ) {
- event_store_release(p->es);
- }
-
- if(pthread_rwlock_rdlock(&store_list_lock))
- abort();
- p = p->jobid_next;
- if(p != es->le) {
- if(pthread_rwlock_rdlock(&p->es->use_lock))
- abort();
- }
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
-
-
- } while(p != es->le);
-
- return 0;
-}
-
-
-/*
- * event_store_recover()
- * - recover after restart or catch up when events missing in IPC
- * - if offset > 0, read everything behind it
- * - if offset == 0, read everything behind min(last_committed_bs, last_committed_es)
- */
-int
-event_store_recover(struct event_store *es)
-{
- struct event_queue *eq_l = NULL, *eq_b = NULL;
- struct server_msg *msg;
- char *event_s;
- int fd, ret;
- long last;
- FILE *ef;
- struct flock efl;
- char err_msg[128];
- struct stat stbuf;
-
- assert(es != NULL);
-
-#if defined(IL_NOTIFICATIONS)
- /* destination queue has to be found for each message separately */
-#else
- /* find bookkeeping server queue */
- eq_b = queue_list_get(es->job_id_s);
- if(eq_b == NULL)
- return(-1);
-#endif
-
-#if !defined(IL_NOTIFICATIONS)
- /* get log server queue */
- eq_l = queue_list_get(NULL);
-#endif
-
- /* lock the event_store and offset locks */
- event_store_lock(es);
- if(pthread_rwlock_wrlock(&es->offset_lock))
- abort();
-
- il_log(LOG_DEBUG, " reading events from %s\n", es->event_file_name);
-
- /* open event file */
- ef = fopen(es->event_file_name, "r");
- if(ef == NULL) {
- snprintf(err_msg, sizeof(err_msg),
- "event_store_recover: error opening event file %s",
- es->event_file_name);
- set_error(IL_SYS, errno, err_msg);
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- return(-1);
- }
-
- /* lock the file for reading (we should not read while dglogd is writing) */
- fd = fileno(ef);
- efl.l_type = F_RDLCK;
- efl.l_whence = SEEK_SET;
- efl.l_start = 0;
- efl.l_len = 0;
- if(fcntl(fd, F_SETLKW, &efl) < 0) {
- snprintf(err_msg, sizeof(err_msg),
- "event_store_recover: error locking event file %s",
- es->event_file_name);
- set_error(IL_SYS, errno, err_msg);
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- fclose(ef);
- return(-1);
- }
-
- /* check the file modification time and size to avoid unnecessary operations */
- memset(&stbuf, 0, sizeof(stbuf));
- if(fstat(fd, &stbuf) < 0) {
- il_log(LOG_ERR, " could not stat event file %s: %s\n", es->event_file_name, strerror(errno));
- fclose(ef);
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- return -1;
- } else {
- if((es->offset == stbuf.st_size) && (es->last_modified == stbuf.st_mtime)) {
- il_log(LOG_DEBUG, " event file not modified since last visit, skipping\n");
- fclose(ef);
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- return(0);
- }
- }
-
- /* check the file size, rename it if it is bigger than max_store_size */
- if(max_store_size > 0 && stbuf.st_size > max_store_size) {
- event_store_rotate_file(es);
- }
-
- while(1) { /* try, try, try */
-
- /* get the position in file to be sought */
- if(es->offset)
- last = es->offset;
- else {
-#if !defined(IL_NOTIFICATIONS)
- if(eq_b == eq_l)
- last = es->last_committed_ls;
- else
-#endif
- /* last = min(ls, bs) */
- /* I took the liberty to optimize this,
- since LS is not used. */
- /* last = (es->last_committed_bs <
- es->last_committed_ls) ? es->last_committed_bs :
- es->last_committed_ls; */
- last = es->last_committed_bs;
- }
-
- il_log(LOG_DEBUG, " setting starting file position to %ld\n", last);
- il_log(LOG_DEBUG, " bytes sent to logging server: %d\n", es->last_committed_ls);
- il_log(LOG_DEBUG, " bytes sent to bookkeeping server: %d\n", es->last_committed_bs);
-
- if(last > 0) {
- int c;
-
- /* skip all committed or already enqueued events */
- /* be careful - check, if the offset really points to the
- beginning of event string */
- if(fseek(ef, last-1, SEEK_SET) < 0) {
- set_error(IL_SYS, errno, "event_store_recover: error setting position for read");
- event_store_unlock(es);
- fclose(ef);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- return(-1);
- }
- /* the last enqueued event MUST end with EVENT_SEPARATOR,
- even if the offset points at EOF */
- if((c=fgetc(ef)) != EVENT_SEPARATOR) {
- /* Houston, we have got a problem */
- il_log(LOG_WARNING,
- " file position %ld does not point at the beginning of event string, backing off!\n",
- last);
- /* now, where were we? */
- if(es->offset) {
- /* next try will be with
- last_commited_bs */
- es->offset = 0;
- } else {
- /* this is really weird... back off completely */
- es->last_committed_ls = es->last_committed_bs = 0;
- }
- } else {
- /* OK, break out of the loop */
- break;
- }
- } else {
- /* this breaks out of the loop, we are starting at
- * the beginning of file
- */
- if(fseek(ef, 0, SEEK_SET) < 0) {
- set_error(IL_SYS, errno, "event_store_recover: error setting position for read");
- event_store_unlock(es);
- fclose(ef);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- return(-1);
- }
- break;
- }
- }
-
- /* now we have:
- * - event file opened at position 'last'
- * - offset and last_committed_* potentially reset to zero
- */
-
- /* release lock on commits, offset remains locked;
- * other threads are allowed to send/remove events, but not insert
- */
- event_store_unlock(es);
-
- /* enqueue all remaining events */
- ret = 1;
- msg = NULL;
- while((event_s=read_event_string(ef)) != NULL) {
- long last_ls, last_bs;
-
- /* last holds the starting position of event_s in file */
- il_log(LOG_DEBUG, " reading event at %ld\n", last);
-
- last_ls = es->last_committed_ls;
- last_bs = es->last_committed_bs;
-
- /* break from now on means there was some error */
- ret = -1;
-
- /* create message for server */
- {
- il_octet_string_t e;
-
- e.data = event_s;
- e.len = strlen(event_s);
- msg = server_msg_create(&e, last);
- free(event_s);
- }
- if(msg == NULL) {
- il_log(LOG_ALERT, " event file corrupted! I will try to move it to quarantine (ie. rename it).\n");
- /* actually do not bother if quarantine succeeded or not - we could not do more */
- event_store_quarantine(es);
- fclose(ef);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- return(-1);
- }
- msg->es = es;
- msg->generation = es->generation;
-
- /* first enqueue to the LS */
- if(!bs_only && (last >= last_ls)) {
-
- il_log(LOG_DEBUG, " queuing event at %ld to logging server\n", last);
-
-#if !defined(IL_NOTIFICATIONS)
- if(enqueue_msg(eq_l, msg) < 0)
- break;
-#endif
- }
-
-#ifdef IL_NOTIFICATIONS
- eq_b = queue_list_get(msg->dest);
- /* if the message does not have destination itself, use destination cached for notification id */
- if(eq_b == NULL) {
- eq_b = notifid_map_get_dest(msg->job_id_s);
- if(eq_b == NULL) {
- /* message has no destination and no destination is known for notification id,
- * commit it immediately
- */
- il_log(LOG_DEBUG, " message has no known destination, will not be sent\n");
- event_store_commit(es, msg->ev_len, 0, msg->generation);
- /* if the expiration changed, set new one now, message will be discarded soon */
- if(msg->expires != notifid_map_get_expiration(msg->job_id_s)) {
- notifid_map_set_expiration(msg->job_id_s, msg->expires);
- }
- }
- }
-#endif
-
- /* now enqueue to the BS, if neccessary */
- if((eq_b != eq_l) &&
- (last >= last_bs)) {
-
- il_log(LOG_DEBUG, " queueing event at %ld to bookkeeping server\n", last);
-
- if(enqueue_msg(eq_b, msg) < 0)
- break;
- }
- server_msg_free(msg);
- msg = NULL;
-
- /* now last is also the offset behind the last successfully queued event */
- last = ftell(ef);
-
- /* ret == 0 means EOF or incomplete event found */
- ret = 0;
-
- } /* while */
-
- es->offset = last;
- es->last_modified = stbuf.st_mtime;
- il_log(LOG_DEBUG, " event store offset set to %ld\n", last);
-
- if(msg)
- server_msg_free(msg);
-
- fclose(ef);
- il_log(LOG_DEBUG, " finished reading events with %d\n", ret);
-
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
-
- return(ret);
-}
-
-
-/*
- * event_store_sync()
- * - check the position of event and fill holes from file
- * - return 1 if the event is new,
- * 0 if it was seen before,
- * -1 if there was an error
- */
-int
-event_store_sync(struct event_store *es, long offset)
-{
- int ret;
-
- assert(es != NULL);
-
- /* Commented out due to the fact that offset as received on socket
- * has little to do with the real event file at the moment. The
- * event will be read from file, socket now serves only to notify
- * about possible event file change.
- */
- ret = event_store_recover_jobid(es);
- ret = (ret < 0) ? ret : 0;
- return(ret);
-
-#if 0
- event_store_lock_ro(es);
- if(es->offset == offset)
- /* we are up to date */
- ret = 1;
- else if(es->offset > offset)
- /* we have already seen this event */
- ret = 0;
- else {
- /* es->offset < offset, i.e. we have missed some events */
- event_store_unlock(es);
- ret = event_store_recover(es);
- /* XXX possible room for intervention by another thread - is there
- * any other thread messing with us?
- * 1) After recover() es->offset is set at the end of file.
- * 2) es->offset is set only by recover() and next().
- * 3) Additional recover can not do much harm.
- * 4) And next() is only called by the same thread as sync().
- * 5) use_lock is in place, so no cleanup possible
- * => no one is messing with us right now */
- event_store_lock_ro(es);
- if(ret < 0)
- ret = -1;
- else
- if(es->offset <= offset) {
- /* Apparently there is something wrong - we are receiving an event
- * which is beyond the end of file. Someone must have removed the file
- * when we were not looking. The question is - what should we do with the event?
- * We have to send it, as this is the only one occasion when we see it.
- * However, we must not allow the es->offset to be set using this event,
- * as it would point after the end of file. Sort this out in event_store_next().
- */
- ret = 1;
- } else if(es->offset > offset) {
- /* we have seen at least this event */
- ret = 0;
- }
- }
- event_store_unlock(es);
- return(ret);
-#endif
-}
-
-
-int
-event_store_next(struct event_store *es, long offset, int len)
-{
- assert(es != NULL);
-
- /* Commented out due to the fact that offset as received on socket
- * has little to do with real event file at the moment. es->offset
- * handling is left solely to the event_store_recover().
- */
-
-#if 0
- event_store_lock(es);
- /* Whoa, be careful now. The es->offset points right after the last enqueued event,
- * but it may not be the offset of the event WE have just enqueued, because:!
- * 1) someone could have removed the event file behind our back
- * 2) the file could have been recover()ed and more events read
- * In either case the offset should not be moved.
- */
- if(es->offset == offset) {
- es->offset += len;
- }
- event_store_unlock(es);
-#endif
-
- return(0);
-}
-
-
-/*
- * event_store_commit()
- *
- */
-int
-event_store_commit(struct event_store *es, int len, int ls, int generation)
-{
- assert(es != NULL);
-
- /* do not move counters if event store with this message was cleaned up
- * (this can happen only when moving to quarantine)
- */
- /* XXX - assume int access is atomic */
- if(generation != es->generation)
- return 0;
-
- event_store_lock(es);
-
- if(ls)
- es->last_committed_ls += len;
- else {
- es->last_committed_bs += len;
- if (bs_only) es->last_committed_ls += len;
- }
-
- if(event_store_write_ctl(es) < 0) {
- event_store_unlock(es);
- return(-1);
- }
-
- event_store_unlock(es);
-
-
- return(0);
-}
-
-
-/*
- * event_store_clean()
- * - remove the event files (event and ctl), if they are not needed anymore
- * - returns 0 if event_store is in use, 1 if it was removed and -1 on error
- *
- * Q: How do we know that we can safely remove the files?
- * A: When all events from file have been committed both by LS and BS.
- */
-static
-int
-event_store_clean(struct event_store *es)
-{
- long last;
- int fd;
- FILE *ef;
- struct flock efl;
-
- assert(es != NULL);
-
- /* prevent sender threads from updating */
- event_store_lock(es);
-
- il_log(LOG_DEBUG, " trying to cleanup event store %s\n", es->job_id_s);
- il_log(LOG_DEBUG, " bytes sent to logging server: %d\n", es->last_committed_ls);
- il_log(LOG_DEBUG, " bytes sent to bookkeeping server: %d\n", es->last_committed_bs);
-
- /* preliminary check to avoid opening event file */
- /* if the positions differ, some events still have to be sent */
- if(es->last_committed_ls != es->last_committed_bs) {
- event_store_unlock(es);
- il_log(LOG_DEBUG, " not all events sent, cleanup aborted\n");
- return(0);
- }
-
- if(fd = pthread_rwlock_wrlock(&es->offset_lock)) {
- fprintf(stderr, "Fatal locking error: %s\n", strerror(fd));
- abort();
- }
-
- /* the file can only be removed when all the events were succesfully sent
- (ie. committed both by LS and BS */
- /* That also implies that the event queues are 'empty' at the moment. */
- ef = fopen(es->event_file_name, "r+");
- if(ef == NULL) {
- /* if we can not open the event store, it is an error and the struct should be removed */
- /* XXX - is it true? */
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- il_log(LOG_ERR, " event_store_clean: error opening event file: %s\n", strerror(errno));
- return(1);
- }
-
- fd = fileno(ef);
-
- /* prevent local-logger from writing into event file */
- efl.l_type = F_WRLCK;
- efl.l_whence = SEEK_SET;
- efl.l_start = 0;
- efl.l_len = 0;
- if(fcntl(fd, F_SETLK, &efl) < 0) {
- il_log(LOG_DEBUG, " could not lock event file, cleanup aborted\n");
- fclose(ef);
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- if(errno != EACCES &&
- errno != EAGAIN) {
- set_error(IL_SYS, errno, "event_store_clean: error locking event file");
- return(-1);
- }
- return(0);
- }
-
- /* now the file should not contain partially written event, so it is safe
- to get offset behind last event by seeking the end of file */
- if(fseek(ef, 0, SEEK_END) < 0) {
- set_error(IL_SYS, errno, "event_store_clean: error seeking the end of file");
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- fclose(ef);
- return(-1);
- }
-
- last = ftell(ef);
- il_log(LOG_DEBUG, " total bytes in file: %d\n", last);
-
- if(es->last_committed_ls < last) {
- fclose(ef);
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- il_log(LOG_DEBUG, " events still waiting in queue, cleanup aborted\n");
- return(0);
- } else if( es->last_committed_ls > last) {
- il_log(LOG_WARNING, " warning: event file seems to shrink!\n");
- /* XXX - in that case we can not continue because there may be
- some undelivered events referring to that event store */
- fclose(ef);
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
- return(0);
- }
-
- /* now we are sure that all events were sent and the event queues are empty */
- il_log(LOG_INFO, " removing event file %s\n", es->event_file_name);
-
- /* remove the event file */
- unlink(es->event_file_name);
- unlink(es->control_file_name);
-
- /* clear the counters */
- es->last_committed_ls = 0;
- es->last_committed_bs = 0;
- es->offset = 0;
-
- /* increasing the generation count is rather pointless here, because there
- are no messages waiting in the queue that would be invalidated */
- /* es->generation++ */
-
- /* unlock the event_store even if it is going to be removed */
- event_store_unlock(es);
- if(pthread_rwlock_unlock(&es->offset_lock))
- abort();
-
- /* close the event file (that unlocks it as well) */
- fclose(ef);
-
- /* indicate that it is safe to remove this event_store */
- return(1);
-}
-
-
-/* --------------------------------
- * event store management functions
- * --------------------------------
- */
-struct event_store *
-event_store_find(char *job_id_s, const char *filename)
-{
- struct event_store_list *q, *p, *d;
- struct event_store *es;
-
- if(pthread_rwlock_wrlock(&store_list_lock)) {
- abort();
- }
-
- es = NULL;
-
- d = NULL;
- p = store_list;
-
- while(p) {
- if(strcmp(p->es->job_id_s, job_id_s) == 0) {
- es = p->es;
- d = p;
- // if filename was given, compare it as well
- if((filename == NULL && p->es->rotate_index == 0) ||
- (filename != NULL && strcmp(p->es->event_file_name, filename) == 0)) {
- if(pthread_rwlock_rdlock(&es->use_lock))
- abort();
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
- return(es);
- }
- }
- p = p->next;
- }
-
- // event store for given jobid and filename was not found, create one
- es = event_store_create(job_id_s, filename);
- if(es == NULL) {
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
- return(NULL);
- }
-
- p = malloc(sizeof(*p));
- if(p == NULL) {
- set_error(IL_NOMEM, ENOMEM, "event_store_find: no room for new event store");
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
- return(NULL);
- }
- p->es = es;
- p->jobid_next = p;
- p->jobid_prev = p;
- es->le = p;
-
- if(filename != NULL && d != NULL) {
- // there is another event store for this jobid;
- // d points to the last event store for this jobid in LL
- // find proper place to insert new event store
- if(p->es->rotate_index == 0) {
- // insert behind d in LL
- p->next = d->next;
- d->next = p;
- // insert behind d in jobid LL
- p->jobid_next = d->jobid_next;
- p->jobid_prev = d;
- d->jobid_next->jobid_prev = p;
- d->jobid_next = p;
- } else {
- struct event_store_list *r;
- q = NULL;
- for(r = d->jobid_next; r != d->jobid_next; r = r->jobid_next) {
- if(p->es->rotate_index < r->es->rotate_index)
- break;
- if(r->es->rotate_index > 0)
- q = r;
- }
- // q has the last lesser non-zero index than p
- if(q == NULL) {
- p->next = store_list;
- store_list = p;
- // insert behind d
- p->jobid_next = d->jobid_next;
- p->jobid_prev = d;
- d->jobid_next->jobid_prev = p;
- d->jobid_next = p;
- } else {
- p->next = q->next;
- q->next = p;
- // insert behind q
- p->jobid_next = q->jobid_next;
- p->jobid_prev = q;
- q->jobid_next->jobid_prev = p;
- q->jobid_next = p;
- }
- }
- } else {
- // insert at the beginning
- p->next = store_list;
- store_list = p;
- }
-
- if(pthread_rwlock_rdlock(&es->use_lock))
- abort();
-
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
-
- return(es);
-}
-
-
-int
-event_store_release(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_unlock(&es->use_lock))
- abort();
- il_log(LOG_DEBUG, " released lock on %s (%s)\n", es->job_id_s, es->event_file_name);
- return(0);
-}
-
-
-static
-int
-event_store_from_file(char *filename)
-{
- struct event_store *es;
- FILE *event_file;
- char *event_s, *job_id_s = NULL;
- int ret;
-#if defined(IL_NOTIFICATIONS)
- edg_wll_Event *notif_event;
- edg_wll_Context context;
- char *dest_name = NULL;
-
-#endif
-
- il_log(LOG_INFO, " attaching to event file: %s\n", filename);
-
- if(strstr(filename, "quarantine") != NULL) {
- il_log(LOG_INFO, " file name belongs to quarantine, not touching that.\n");
- return(0);
- }
-
- event_file = fopen(filename, "r");
- if(event_file == NULL) {
- set_error(IL_SYS, errno, "event_store_from_file: error opening event file");
- return(-1);
- }
- event_s = read_event_string(event_file);
- fclose(event_file);
- if(event_s == NULL)
- return(0);
-
-#if defined(IL_NOTIFICATIONS)
- edg_wll_InitContext(&context);
- ret=edg_wll_ParseNotifEvent(context, event_s, ¬if_event);
- edg_wll_FreeContext(context);
- if(ret) {
- set_error(IL_LBAPI, ret, "event_store_from_file: could not parse event");
- ret = -1;
- goto out;
- }
- if(notif_event->notification.notifId == NULL) {
- set_error(IL_LBAPI, EDG_WLL_ERROR_PARSE_BROKEN_ULM,
- "event_store_from_file: parse error - no notif id");
- ret = -1;
- goto out;
- }
- if((job_id_s = edg_wll_NotifIdUnparse(notif_event->notification.notifId)) == NULL) {
- set_error(IL_SYS, ENOMEM, "event_store_from_file: could not copy id");
- ret = -1;
- goto out;
- }
- /* XXX: what was that good for?
- if(notif_event->notification.dest_host &&
- (strlen(notif_event->notification.dest_host) > 0)) {
- asprintf(&dest_name, "%s:%d", notif_event->notification.dest_host, notif_event->notification.dest_port);
- }
- */
-
-#else
- job_id_s = edg_wll_GetJobId(event_s);
-#endif
- il_log(LOG_DEBUG, " event id: '%s'\n", job_id_s);
- if(job_id_s == NULL) {
- il_log(LOG_NOTICE, " skipping file, could not parse event\n");
- ret = 0;
- goto out;
- }
-
- es = event_store_find(job_id_s, filename);
-
- if(es == NULL) {
- ret = -1;
- goto out;
- }
-
- if((es->last_committed_ls == 0) &&
- (es->last_committed_bs == 0) &&
- (es->offset == 0)) {
- ret = event_store_read_ctl(es);
- } else
- ret = 0;
-
- event_store_release(es);
-
-out:
-#if defined(IL_NOTIFICATIONS)
- if(notif_event) {
- edg_wll_FreeEvent(notif_event);
- free(notif_event);
- }
-#endif
- if(event_s) free(event_s);
- if(job_id_s) free(job_id_s);
- return(ret);
-}
-
-
-int
-event_store_init(char *prefix)
-{
- if(file_prefix == NULL) {
- file_prefix = strdup(prefix);
- store_list = NULL;
- }
-
- /* read directory and get a list of event files */
- {
- int len;
-
- char *p, *dir;
- DIR *event_dir;
- struct dirent *entry;
-
-
- /* get directory name */
- p = strrchr(file_prefix, '/');
- if(p == NULL) {
- dir = strdup(".");
- p = "";
- len = 0;
- } else {
- *p = '\0';
- dir = strdup(file_prefix);
- *p++ = '/';
- len = strlen(p);
- }
-
- event_dir = opendir(dir);
- if(event_dir == NULL) {
- free(dir);
- set_error(IL_SYS, errno, "event_store_init: error opening event directory");
- return(-1);
- }
-
- while((entry=readdir(event_dir))) {
- char *s;
-
- /* skip all files that do not match prefix */
- if(strncmp(entry->d_name, p, len) != 0)
- continue;
-
- /* skip all control files */
- if((s=strstr(entry->d_name, ".ctl")) != NULL &&
- s[4] == '\0')
- continue;
-
- s = malloc(strlen(dir) + strlen(entry->d_name) + 2);
- if(s == NULL) {
- free(dir);
- set_error(IL_NOMEM, ENOMEM, "event_store_init: no room for file name");
- return(-1);
- }
-
- *s = '\0';
- strcat(s, dir);
- strcat(s, "/");
- strcat(s, entry->d_name);
-
- if(event_store_from_file(s) < 0) {
- free(dir);
- free(s);
- closedir(event_dir);
- return(-1);
- }
-
- free(s);
- }
- closedir(event_dir);
-
- /* one more pass - this time remove stale .ctl files */
- event_dir = opendir(dir);
- if(event_dir == NULL) {
- free(dir);
- set_error(IL_SYS, errno, "event_store_init: error opening event directory");
- return(-1);
- }
-
- while((entry=readdir(event_dir))) {
- char *s;
-
- /* skip all files that do not match prefix */
- if(strncmp(entry->d_name, p, len) != 0)
- continue;
-
- /* find all control files */
- if((s=strstr(entry->d_name, ".ctl")) != NULL &&
- s[4] == '\0') {
- char *ef;
- struct stat st;
-
- /* is there corresponding event file? */
- ef = malloc(strlen(dir) + strlen(entry->d_name) + 2);
- if(ef == NULL) {
- free(dir);
- set_error(IL_NOMEM, ENOMEM, "event_store_init: no room for event file name");
- return(-1);
- }
-
- s[0] = 0;
- *ef = '\0';
- strcat(ef, dir);
- strcat(ef, "/");
- strcat(ef, entry->d_name);
- s[0] = '.';
-
- if(stat(ef, &st) == 0) {
- /* something is there */
- /* XXX - it could be something else than event file, but do not bother now */
- } else {
- /* could not stat file, remove ctl */
- strcat(ef, s);
- il_log(LOG_DEBUG, " removing stale file %s\n", ef);
- if(unlink(ef))
- il_log(LOG_ERR, " could not remove file %s: %s\n", ef, strerror(errno));
-
- }
- free(ef);
-
- }
- }
- closedir(event_dir);
- free(dir);
- }
-
- return(0);
-}
-
-
-int
-event_store_recover_all()
-{
- struct event_store_list *sl;
-
-
- if(pthread_rwlock_rdlock(&store_list_lock))
- abort();
-
- /* recover all event stores */
- sl = store_list;
- while(sl != NULL) {
-
- /* recover this event store */
- /* no need to lock use_lock in event_store, the store_list_lock is in place */
- if(event_store_recover(sl->es) < 0) {
- il_log(LOG_ERR, " error recovering event store %s:\n %s\n", sl->es->event_file_name, error_get_msg());
- clear_error();
- }
- sl = sl->next;
- }
-
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
-
- return(0);
-}
-
-
-#if 0
-int
-event_store_remove(struct event_store *es)
-{
- struct event_store_list *p, **q;
-
- assert(es != NULL);
-
- switch(event_store_clean(es)) {
- case 0:
- il_log(LOG_DEBUG, " event store not removed, still used\n");
- return(0);
-
- case 1:
- if(pthread_rwlock_wrlock(&store_list_lock) < 0) {
- set_error(IL_SYS, errno, " event_store_remove: error locking event store list");
- return(-1);
- }
-
- p = store_list;
- q = &store_list;
-
- while(p) {
- if(p->es == es) {
- (*q) = p->next;
- event_store_free(es);
- free(p);
- break;
- }
- q = &(p->next);
- p = p->next;
- }
-
- if(pthread_rwlock_unlock(&store_list_lock) < 0) {
- set_error(IL_SYS, errno, " event_store_remove: error unlocking event store list");
- return(-1);
- }
- return(1);
-
- default:
- return(-1);
- }
- /* not reached */
- return(0);
-}
-#endif
-
-int
-event_store_cleanup()
-{
- struct event_store_list *sl;
- struct event_store_list *slnext;
- struct event_store_list **prev;
-
- /* try to remove event files */
-
- if(pthread_rwlock_wrlock(&store_list_lock))
- abort();
-
- sl = store_list;
- prev = &store_list;
-
- while(sl != NULL) {
- int ret;
-
- slnext = sl->next;
-
- /* one event store at time */
- ret = pthread_rwlock_trywrlock(&sl->es->use_lock);
- if(ret == EBUSY) {
- il_log(LOG_DEBUG, " event_store %s is in use by another thread\n",
- sl->es->job_id_s);
- sl = slnext;
- continue;
- } else if (ret < 0)
- abort();
-
- switch(event_store_clean(sl->es)) {
-
- case 1:
- /* remove this event store from LL */
- (*prev) = slnext;
- /* remove this event store from jobid's LL */
- if(sl->jobid_next != sl) {
- sl->jobid_prev->jobid_next = sl->jobid_next;
- sl->jobid_next->jobid_prev = sl->jobid_prev;
- }
- event_store_free(sl->es);
- free(sl);
- break;
-
- case -1:
- il_log(LOG_ERR, " error removing event store %s (file %s):\n %s\n",
- sl->es->job_id_s, sl->es->event_file_name, error_get_msg());
- /* event_store_release(sl->es); */
- clear_error();
- /* go on to the next */
-
- default:
- event_store_release(sl->es);
- prev = &(sl->next);
- break;
- }
-
- sl = slnext;
- }
-
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
-
- return(0);
-}
-
+++ /dev/null
-#ident "$Header$"
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <sys/param.h>
-
-#include "glite/lb/events_parse.h"
-
-#include "interlogd.h"
-
-#ifdef __GNUC__
-#define UNUSED_VAR __attribute__((unused))
-#else
-#define UNUSED_VAR
-#endif
-
-static char *file_prefix = NULL;
-
-
-struct event_store_list {
- struct event_store *es;
- struct event_store_list *next;
-};
-
-
-static struct event_store_list *store_list;
-static pthread_rwlock_t store_list_lock = PTHREAD_RWLOCK_INITIALIZER;
-
-
-/* ----------------
- * helper functions
- * ----------------
- */
-static
-char *
-jobid2eventfile(const char *job_id_s)
-{
- char *buffer;
-
- if(job_id_s) {
- asprintf(&buffer, "%s.%s", file_prefix, job_id_s);
- } else
- asprintf(&buffer, "%s.default", file_prefix);
-
- return(buffer);
-}
-
-
-static
-char *
-jobid2controlfile(char *job_id_s)
-{
- char *buffer;
- char *hash;
-
- if(job_id_s) {
- asprintf(&buffer, "%s.%s.ctl", file_prefix, job_id_s);
- } else
- asprintf(&buffer, "%s.default.ctl", file_prefix);
-
- return(buffer);
-}
-
-static
-int
-file_reader(void *user_data, char *buffer, const int len)
-{
- size_t ret = 0;
-
- if(len > 0) {
- ret = fread(buffer, 1, len, (FILE*)user_data);
- if(ret == 0 && ferror((FILE*)user_data)) {
- return -1;
- }
- }
- return ret;
-}
-
-
-static
-int
-read_event_string(FILE *file, il_http_message_t *msg)
-{
- int len, ret;
- int fd = fileno(file);
- long start;
-
- /* remember the start position */
- start = ftell(file);
- ret = receive_http(file, file_reader, msg);
- if(ret < 0) return ret;
- /* seek at the end of message in case the reader read ahead */
- len = fseek(file, start + msg->len, SEEK_SET);
- len = fgetc(file);
- if(len != '\n') {
- il_log(LOG_ERR, "error reading event from file, missing terminator character at %d, found %c(%d))\n",
- start+msg->len, len, len);
- if(msg->data) { free(msg->data); msg->data = NULL; }
- if(msg->host) { free(msg->host); msg->host = NULL; }
- return EINVAL;
- }
- return ret;
-}
-
-
-
-/* ------------------------------
- * event_store 'member' functions
- * ------------------------------
- */
-static
-int
-event_store_free(struct event_store *es)
-{
- assert(es != NULL);
-
- if(es->job_id_s) free(es->job_id_s);
- if(es->event_file_name) free(es->event_file_name);
- if(es->control_file_name) free(es->control_file_name);
- pthread_rwlock_destroy(&es->use_lock);
- pthread_rwlock_destroy(&es->commit_lock);
- free(es);
-
- return(0);
-}
-
-
-static
-struct event_store *
-event_store_create(char *job_id_s)
-{
- struct event_store *es;
-
- es = malloc(sizeof(*es));
- if(es == NULL) {
- set_error(IL_NOMEM, ENOMEM, "event_store_create: error allocating room for structure");
- return(NULL);
- }
-
- memset(es, 0, sizeof(*es));
-
- il_log(LOG_DEBUG, " creating event store for id %s\n", job_id_s);
-
- es->job_id_s = strdup(job_id_s);
- es->event_file_name = jobid2eventfile(job_id_s);
- es->control_file_name = jobid2controlfile(job_id_s);
-
- if(pthread_rwlock_init(&es->commit_lock, NULL))
- abort();
- if(pthread_rwlock_init(&es->use_lock, NULL))
- abort();
-
- return(es);
-}
-
-
-static
-int
-event_store_lock_ro(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_rdlock(&es->commit_lock))
- abort();
-
- return(0);
-}
-
-
-static
-int
-event_store_lock(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_wrlock(&es->commit_lock))
- abort();
-
- return(0);
-}
-
-
-static
-int
-event_store_unlock(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_unlock(&es->commit_lock))
- abort();
- return(0);
-}
-
-
-static
-int
-event_store_read_ctl(struct event_store *es)
-{
- FILE *ctl_file;
-
- assert(es != NULL);
-
- event_store_lock(es);
- if((ctl_file = fopen(es->control_file_name, "r")) == NULL) {
- /* no control file, new event file */
- es->last_committed_ls = 0;
- es->last_committed_bs = 0;
- } else {
- /* read last seen and last committed counts */
- fscanf(ctl_file, "%*s\n%ld\n%ld\n",
- &es->last_committed_ls,
- &es->last_committed_bs);
- fclose(ctl_file);
- }
- event_store_unlock(es);
-
- return(0);
-}
-
-
-static
-int
-event_store_write_ctl(struct event_store *es)
-{
- FILE *ctl;
-
- assert(es != NULL);
-
- ctl = fopen(es->control_file_name, "w");
- if(ctl == NULL) {
- set_error(IL_SYS, errno, "event_store_write_ctl: error opening control file");
- return(-1);
- }
-
- if(fprintf(ctl, "%s\n%ld\n%ld\n",
- es->job_id_s,
- es->last_committed_ls,
- es->last_committed_bs) < 0) {
- set_error(IL_SYS, errno, "event_store_write_ctl: error writing control record");
- return(-1);
- }
-
- if(fclose(ctl) < 0) {
- set_error(IL_SYS, errno, "event_store_write_ctl: error closing control file");
- return(-1);
- }
-
- return(0);
-}
-
-
-/*
- * event_store_qurantine()
- * - rename damaged event store file
- * - essentially does the same actions as cleanup, but the event store
- * does not have to be empty
- * returns 0 on success, -1 on error
- */
-static
-int
-event_store_quarantine(struct event_store *es)
-{
- int num;
- char newname[MAXPATHLEN+1];
-
- /* find available qurantine name */
- /* we give it at most 1024 tries */
- for(num = 0; num < 1024; num++) {
- struct stat st;
-
- snprintf(newname, MAXPATHLEN, "%s.quarantine.%d", es->event_file_name, num);
- newname[MAXPATHLEN] = 0;
- if(stat(newname, &st) < 0) {
- if(errno == ENOENT) {
- /* file not found */
- break;
- } else {
- /* some other error with name, probably permanent */
- set_error(IL_SYS, errno, "event_store_qurantine: error looking for qurantine filename");
- return(-1);
-
- }
- } else {
- /* the filename is used already */
- }
- }
- if(num >= 1024) {
- /* new name not found */
- /* XXX - is there more suitable error? */
- set_error(IL_SYS, ENOSPC, "event_store_quarantine: exhausted number of retries looking for quarantine filename");
- return(-1);
- }
-
- /* actually rename the file */
- il_log(LOG_DEBUG, " renaming damaged event file from %s to %s\n",
- es->event_file_name, newname);
- if(rename(es->event_file_name, newname) < 0) {
- set_error(IL_SYS, errno, "event_store_quarantine: error renaming event file");
- return(-1);
- }
-
- /* clear the counters */
- es->last_committed_ls = 0;
- es->last_committed_bs = 0;
- es->offset = 0;
-
- return(0);
-}
-
-
-/*
- * event_store_recover()
- * - recover after restart or catch up when events missing in IPC
- * - if offset > 0, read everything behind it
- * - if offset == 0, read everything behind min(last_committed_bs, last_committed_es)
- */
-int
-event_store_recover(struct event_store *es)
-{
- struct event_queue *eq_l = NULL, *eq_b = NULL;
- struct server_msg *msg;
- il_http_message_t hmsg;
- char *event_s;
- int fd, ret;
- long last;
- FILE *ef;
- struct flock efl;
- char err_msg[128];
- struct stat stbuf;
-
- assert(es != NULL);
-
-#if defined(IL_NOTIFICATIONS)
- /* destination queue has to be found for each message separately */
-#else
- /* find bookkepping server queue */
- eq_b = queue_list_get(es->job_id_s);
- if(eq_b == NULL)
- return(-1);
-#endif
-
-#if !defined(IL_NOTIFICATIONS)
- /* get log server queue */
- eq_l = queue_list_get(NULL);
-#endif
-
- event_store_lock(es);
-
- il_log(LOG_DEBUG, " reading events from %s\n", es->event_file_name);
-
- /* open event file */
- ef = fopen(es->event_file_name, "r");
- if(ef == NULL) {
- snprintf(err_msg, sizeof(err_msg),
- "event_store_recover: error opening event file %s",
- es->event_file_name);
- set_error(IL_SYS, errno, err_msg);
- event_store_unlock(es);
- return(-1);
- }
-
- /* lock the file for reading (we should not read while dglogd is writing) */
- fd = fileno(ef);
- efl.l_type = F_RDLCK;
- efl.l_whence = SEEK_SET;
- efl.l_start = 0;
- efl.l_len = 0;
- if(fcntl(fd, F_SETLKW, &efl) < 0) {
- snprintf(err_msg, sizeof(err_msg),
- "event_store_recover: error locking event file %s",
- es->event_file_name);
- set_error(IL_SYS, errno, err_msg);
- event_store_unlock(es);
- fclose(ef);
- return(-1);
- }
-
- /* check the file modification time and size to avoid unnecessary operations */
- memset(&stbuf, 0, sizeof(stbuf));
- if(fstat(fd, &stbuf) < 0) {
- il_log(LOG_ERR, " could not stat event file %s: %s\n", es->event_file_name, strerror(errno));
- fclose(ef);
- event_store_unlock(es);
- return -1;
- } else {
- if((es->offset == stbuf.st_size) && (es->last_modified == stbuf.st_mtime)) {
- il_log(LOG_DEBUG, " event file not modified since last visit, skipping\n");
- fclose(ef);
- event_store_unlock(es);
- return(0);
- }
- }
-
- while(1) { /* try, try, try */
-
- /* get the position in file to be sought */
- if(es->offset)
- last = es->offset;
- else {
- last = es->last_committed_bs;
- }
-
- il_log(LOG_DEBUG, " setting starting file position to %ld\n", last);
- il_log(LOG_DEBUG, " bytes sent to destination: %d\n", es->last_committed_bs);
-
- if(last > 0) {
- int c;
-
- /* skip all committed or already enqueued events */
- /* be careful - check, if the offset really points to the
- beginning of event string */
- if(fseek(ef, last - 1, SEEK_SET) < 0) {
- set_error(IL_SYS, errno, "event_store_recover: error setting position for read");
- event_store_unlock(es);
- fclose(ef);
- return(-1);
- }
- /* the last enqueued event MUST end with \n */
- if((c=fgetc(ef)) != '\n') {
- /* Houston, we have got a problem */
- il_log(LOG_WARNING,
- " file position %ld does not point at the beginning of event string, backing off!\n",
- last);
- /* now, where were we? */
- if(es->offset) {
- /* next try will be with
- last_commited_bs */
- es->offset = 0;
- } else {
- /* this is really weird... back off completely */
- es->last_committed_ls = es->last_committed_bs = 0;
- }
- } else {
- /* OK, break out of the loop */
- break;
- }
- } else {
- /* this breaks out of the loop, we are starting at
- * the beginning of file
- */
- if(fseek(ef, 0, SEEK_SET) < 0) {
- set_error(IL_SYS, errno, "event_store_recover: error setting position for read");
- event_store_unlock(es);
- fclose(ef);
- return(-1);
- }
- break;
- }
- }
-
- /* enqueue all remaining events */
- ret = 1;
- msg = NULL;
- while(read_event_string(ef, &hmsg) >= 0) {
-
- /* last holds the starting position of event_s in file */
- il_log(LOG_DEBUG, " reading event at %ld\n", last);
-
- /* break from now on means there was some error */
- ret = -1;
-
- /* create message for server */
- msg = server_msg_create((il_octet_string_t*)&hmsg, last);
- if(msg == NULL) {
- il_log(LOG_ALERT, " event file corrupted! I will try to move it to quarantine (ie. rename it).\n");
- /* actually do not bother if quarantine succeeded or not - we could not do more */
- event_store_quarantine(es);
- fclose(ef);
- event_store_unlock(es);
- return(-1);
- }
- msg->es = es;
-
- /* first enqueue to the LS */
- if(!bs_only && (last >= es->last_committed_ls)) {
-
- il_log(LOG_DEBUG, " queueing event at %ld to server %s\n", last, eq_l->dest_name);
-
-#if !defined(IL_NOTIFICATIONS)
- if(enqueue_msg(eq_l, msg) < 0)
- break;
-#endif
- }
-
-#ifdef IL_NOTIFICATIONS
- eq_b = queue_list_get(msg->dest);
-#endif
-
- /* now enqueue to the BS, if neccessary */
- if((eq_b != eq_l) &&
- (last >= es->last_committed_bs)) {
-
- il_log(LOG_DEBUG, " queueing event at %ld to server %s\n", last, eq_b->dest_name);
-
- if(enqueue_msg(eq_b, msg) < 0)
- break;
- }
- server_msg_free(msg);
- msg = NULL;
-
- /* now last is also the offset behind the last successfully queued event */
- last = ftell(ef);
-
- /* ret == 0 means EOF or incomplete event found */
- ret = 0;
-
- } /* while */
-
- /* due to this little assignment we had to lock the event_store for writing */
- es->offset = last;
- es->last_modified = stbuf.st_mtime;
- il_log(LOG_DEBUG, " event store offset set to %ld\n", last);
-
- if(msg)
- server_msg_free(msg);
-
- fclose(ef);
- il_log(LOG_DEBUG, " finished reading events with %d\n", ret);
-
- event_store_unlock(es);
- return(ret);
-}
-
-
-/*
- * event_store_sync()
- * - check the position of event and fill holes from file
- * - return 1 if the event is new,
- * 0 if it was seen before,
- * -1 if there was an error
- */
-int
-event_store_sync(struct event_store *es, long offset)
-{
- int ret;
-
- assert(es != NULL);
-
- /* all events are actually read from file, the event on socket
- * is ignored and serves just to notify us about file change
- */
- ret = event_store_recover(es);
- ret = (ret < 0) ? ret : 0;
- return(ret);
-}
-
-
-int
-event_store_next(struct event_store *es, long offset, int len)
-{
- assert(es != NULL);
-
- /* offsets are good only to detect losses (differences between socket and file),
- which is not possible now */
- return 0;
-}
-
-
-/*
- * event_store_commit()
- *
- */
-int
-event_store_commit(struct event_store *es, int len, int ls)
-{
- assert(es != NULL);
-
- event_store_lock(es);
-
- if(ls)
- es->last_committed_ls += len;
- else {
- es->last_committed_bs += len;
- if (bs_only) es->last_committed_ls += len;
- }
-
- if(event_store_write_ctl(es) < 0) {
- event_store_unlock(es);
- return(-1);
- }
-
- event_store_unlock(es);
-
-
- return(0);
-}
-
-
-/*
- * event_store_clean()
- * - remove the event files (event and ctl), if they are not needed anymore
- * - returns 0 if event_store is in use, 1 if it was removed and -1 on error
- *
- * Q: How do we know that we can safely remove the files?
- * A: When all events from file have been committed both by LS and BS.
- */
-static
-int
-event_store_clean(struct event_store *es)
-{
- long last;
- int fd;
- FILE *ef;
- struct flock efl;
-
- assert(es != NULL);
-
- /* prevent sender threads from updating */
- event_store_lock(es);
-
- il_log(LOG_DEBUG, " trying to cleanup event store %s\n", es->job_id_s);
- il_log(LOG_DEBUG, " bytes sent to logging server: %d\n", es->last_committed_ls);
- il_log(LOG_DEBUG, " bytes sent to bookkeeping server: %d\n", es->last_committed_bs);
-
- /* preliminary check to avoid opening event file */
- /* if the positions differ, some events still have to be sent */
- if(es->last_committed_ls != es->last_committed_bs) {
- event_store_unlock(es);
- il_log(LOG_DEBUG, " not all events sent, cleanup aborted\n");
- return(0);
- }
-
- /* the file can only be removed when all the events were succesfully sent
- (ie. committed both by LS and BS */
- /* That also implies that the event queues are 'empty' at the moment. */
- ef = fopen(es->event_file_name, "r+");
- if(ef == NULL) {
- /* if we can not open the event store, it is an error and the struct should be removed */
- /* XXX - is it true? */
- event_store_unlock(es);
- il_log(LOG_ERR, " event_store_clean: error opening event file: %s\n", strerror(errno));
- return(1);
- }
-
- fd = fileno(ef);
-
- /* prevent local-logger from writing into event file */
- efl.l_type = F_WRLCK;
- efl.l_whence = SEEK_SET;
- efl.l_start = 0;
- efl.l_len = 0;
- if(fcntl(fd, F_SETLK, &efl) < 0) {
- il_log(LOG_DEBUG, " could not lock event file, cleanup aborted\n");
- fclose(ef);
- event_store_unlock(es);
- if(errno != EACCES &&
- errno != EAGAIN) {
- set_error(IL_SYS, errno, "event_store_clean: error locking event file");
- return(-1);
- }
- return(0);
- }
-
- /* now the file should not contain partially written event, so it is safe
- to get offset behind last event by seeking the end of file */
- if(fseek(ef, 0, SEEK_END) < 0) {
- set_error(IL_SYS, errno, "event_store_clean: error seeking the end of file");
- event_store_unlock(es);
- fclose(ef);
- return(-1);
- }
-
- last = ftell(ef);
- il_log(LOG_DEBUG, " total bytes in file: %d\n", last);
-
- if(es->last_committed_ls < last) {
- fclose(ef);
- event_store_unlock(es);
- il_log(LOG_DEBUG, " events still waiting in queue, cleanup aborted\n");
- return(0);
- } else if( es->last_committed_ls > last) {
- il_log(LOG_WARNING, " warning: event file seems to shrink!\n");
- /* XXX - in that case we can not continue because there may be
- some undelivered events referring to that event store */
- fclose(ef);
- event_store_unlock(es);
- return(0);
- }
-
- /* now we are sure that all events were sent and the event queues are empty */
- il_log(LOG_INFO, " removing event file %s\n", es->event_file_name);
-
- /* remove the event file */
- unlink(es->event_file_name);
- unlink(es->control_file_name);
-
- /* clear the counters */
- es->last_committed_ls = 0;
- es->last_committed_bs = 0;
- es->offset = 0;
-
- /* unlock the event_store even if it is going to be removed */
- event_store_unlock(es);
-
- /* close the event file (that unlocks it as well) */
- fclose(ef);
-
- /* indicate that it is safe to remove this event_store */
- return(1);
-}
-
-
-/* --------------------------------
- * event store management functions
- * --------------------------------
- */
-struct event_store *
-event_store_find(char *job_id_s)
-{
- struct event_store_list *q, *p;
- struct event_store *es;
-
- if(pthread_rwlock_wrlock(&store_list_lock)) {
- abort();
- }
-
- es = NULL;
-
- q = NULL;
- p = store_list;
-
- while(p) {
- if(strcmp(p->es->job_id_s, job_id_s) == 0) {
- es = p->es;
- if(pthread_rwlock_rdlock(&es->use_lock))
- abort();
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
- return(es);
- }
-
- q = p;
- p = p->next;
- }
-
- es = event_store_create(job_id_s);
- if(es == NULL) {
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
- return(NULL);
- }
-
- p = malloc(sizeof(*p));
- if(p == NULL) {
- set_error(IL_NOMEM, ENOMEM, "event_store_find: no room for new event store");
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
- return(NULL);
- }
-
- p->next = store_list;
- store_list = p;
-
- p->es = es;
-
- if(pthread_rwlock_rdlock(&es->use_lock))
- abort();
-
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
-
- return(es);
-}
-
-
-int
-event_store_release(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_unlock(&es->use_lock))
- abort();
- il_log(LOG_DEBUG, " released lock on %s\n", es->job_id_s);
- return(0);
-}
-
-
-event_store_from_file(char *filename)
-{
- struct event_store *es;
- FILE *event_file;
- char *job_id_s = NULL, *p;
- il_http_message_t hmsg;
- int ret;
-
- il_log(LOG_INFO, " attaching to event file: %s\n", filename);
-
- if(strstr(filename, "quarantine") != NULL) {
- il_log(LOG_INFO, " file name belongs to quarantine, not touching that.\n");
- return(0);
- }
-
- event_file = fopen(filename, "r");
- if(event_file == NULL) {
- set_error(IL_SYS, errno, "event_store_from_file: error opening event file");
- return(-1);
- }
- ret = read_event_string(event_file, &hmsg);
- fclose(event_file);
- if(ret < 0)
- return(0);
-
- /* get id aka dest */
- job_id_s = hmsg.host;
-
- il_log(LOG_DEBUG, " message dest: '%s'\n", job_id_s);
- if(job_id_s == NULL) {
- il_log(LOG_NOTICE, " skipping file, could not parse event\n");
- ret = 0;
- goto out;
- }
-
- es=event_store_find(job_id_s);
-
- if(es == NULL) {
- ret = -1;
- goto out;
- }
-
- if((es->last_committed_ls == 0) &&
- (es->last_committed_bs == 0) &&
- (es->offset == 0)) {
- ret = event_store_read_ctl(es);
- } else
- ret = 0;
-
- event_store_release(es);
-
-out:
- if(hmsg.data) free(hmsg.data);
- if(job_id_s) free(job_id_s);
- return(ret);
-}
-
-
-int
-event_store_init(char *prefix)
-{
- if(file_prefix == NULL) {
- file_prefix = strdup(prefix);
- store_list = NULL;
- }
-
- /* read directory and get a list of event files */
- {
- int len;
-
- char *p, *dir;
- DIR *event_dir;
- struct dirent *entry;
-
-
- /* get directory name */
- p = strrchr(file_prefix, '/');
- if(p == NULL) {
- dir = strdup(".");
- p = "";
- len = 0;
- } else {
- *p = '\0';
- dir = strdup(file_prefix);
- *p++ = '/';
- len = strlen(p);
- }
-
- event_dir = opendir(dir);
- if(event_dir == NULL) {
- free(dir);
- set_error(IL_SYS, errno, "event_store_init: error opening event directory");
- return(-1);
- }
-
- while((entry=readdir(event_dir))) {
- char *s;
-
- /* skip all files that do not match prefix */
- if(strncmp(entry->d_name, p, len) != 0)
- continue;
-
- /* skip all control files */
- if((s=strstr(entry->d_name, ".ctl")) != NULL &&
- s[4] == '\0')
- continue;
-
- s = malloc(strlen(dir) + strlen(entry->d_name) + 2);
- if(s == NULL) {
- free(dir);
- set_error(IL_NOMEM, ENOMEM, "event_store_init: no room for file name");
- return(-1);
- }
-
- *s = '\0';
- strcat(s, dir);
- strcat(s, "/");
- strcat(s, entry->d_name);
-
- if(event_store_from_file(s) < 0) {
- free(dir);
- free(s);
- closedir(event_dir);
- return(-1);
- }
-
- free(s);
- }
- closedir(event_dir);
-
- /* one more pass - this time remove stale .ctl files */
- event_dir = opendir(dir);
- if(event_dir == NULL) {
- free(dir);
- set_error(IL_SYS, errno, "event_store_init: error opening event directory");
- return(-1);
- }
-
- while((entry=readdir(event_dir))) {
- char *s;
-
- /* skip all files that do not match prefix */
- if(strncmp(entry->d_name, p, len) != 0)
- continue;
-
- /* find all control files */
- if((s=strstr(entry->d_name, ".ctl")) != NULL &&
- s[4] == '\0') {
- char *ef;
- struct stat st;
-
- /* is there corresponding event file? */
- ef = malloc(strlen(dir) + strlen(entry->d_name) + 2);
- if(ef == NULL) {
- free(dir);
- set_error(IL_NOMEM, ENOMEM, "event_store_init: no room for event file name");
- return(-1);
- }
-
- s[0] = 0;
- *ef = '\0';
- strcat(ef, dir);
- strcat(ef, "/");
- strcat(ef, entry->d_name);
- s[0] = '.';
-
- if(stat(ef, &st) == 0) {
- /* something is there */
- /* XXX - it could be something else than event file, but do not bother now */
- } else {
- /* could not stat file, remove ctl */
- strcat(ef, s);
- il_log(LOG_DEBUG, " removing stale file %s\n", ef);
- if(unlink(ef))
- il_log(LOG_ERR, " could not remove file %s: %s\n", ef, strerror(errno));
-
- }
- free(ef);
-
- }
- }
- closedir(event_dir);
- free(dir);
- }
-
- return(0);
-}
-
-
-int
-event_store_recover_all()
-{
- struct event_store_list *sl;
-
-
- if(pthread_rwlock_rdlock(&store_list_lock))
- abort();
-
- /* recover all event stores */
- sl = store_list;
- while(sl != NULL) {
-
- /* recover this event store */
- /* no need to lock use_lock in event_store, the store_list_lock is in place */
- if(event_store_recover(sl->es) < 0) {
- il_log(LOG_ERR, " error recovering event store %s:\n %s\n", sl->es->event_file_name, error_get_msg());
- clear_error();
- }
- sl = sl->next;
- }
-
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
-
- return(0);
-}
-
-
-#if 0
-int
-event_store_remove(struct event_store *es)
-{
- struct event_store_list *p, **q;
-
- assert(es != NULL);
-
- switch(event_store_clean(es)) {
- case 0:
- il_log(LOG_DEBUG, " event store not removed, still used\n");
- return(0);
-
- case 1:
- if(pthread_rwlock_wrlock(&store_list_lock) < 0) {
- set_error(IL_SYS, errno, " event_store_remove: error locking event store list");
- return(-1);
- }
-
- p = store_list;
- q = &store_list;
-
- while(p) {
- if(p->es == es) {
- (*q) = p->next;
- event_store_free(es);
- free(p);
- break;
- }
- q = &(p->next);
- p = p->next;
- }
-
- if(pthread_rwlock_unlock(&store_list_lock) < 0) {
- set_error(IL_SYS, errno, " event_store_remove: error unlocking event store list");
- return(-1);
- }
- return(1);
-
- default:
- return(-1);
- }
- /* not reached */
- return(0);
-}
-#endif
-
-int
-event_store_cleanup()
-{
- struct event_store_list *sl;
- struct event_store_list *slnext;
- struct event_store_list **prev;
-
- /* try to remove event files */
-
- if(pthread_rwlock_wrlock(&store_list_lock))
- abort();
-
- sl = store_list;
- prev = &store_list;
-
- while(sl != NULL) {
- int ret;
-
- slnext = sl->next;
-
- /* one event store at time */
- ret = pthread_rwlock_trywrlock(&sl->es->use_lock);
- if(ret == EBUSY) {
- il_log(LOG_DEBUG, " event_store %s is in use by another thread\n",
- sl->es->job_id_s);
- sl = slnext;
- continue;
- } else if (ret < 0)
- abort();
-
- switch(event_store_clean(sl->es)) {
-
- case 1:
- /* remove this event store */
- (*prev) = slnext;
- event_store_free(sl->es);
- free(sl);
- break;
-
- case -1:
- il_log(LOG_ERR, " error removing event store %s (file %s):\n %s\n",
- sl->es->job_id_s, sl->es->event_file_name, error_get_msg());
- /* event_store_release(sl->es); */
- clear_error();
- /* go on to the next */
-
- default:
- event_store_release(sl->es);
- prev = &(sl->next);
- break;
- }
-
- sl = slnext;
- }
-
- if(pthread_rwlock_unlock(&store_list_lock))
- abort();
-
- return(0);
-}
-
+++ /dev/null
-#ident "$Header$"
-
-#include <string.h>
-#include <errno.h>
-
-#include "interlogd.h"
-
-
-int
-parse_request(const char *s, il_http_message_t *msg)
-{
- if(!strncasecmp(s, "HTTP", 4)) {
- msg->msg_type = IL_HTTP_REPLY;
- } else if(!strncasecmp(s, "POST", 4)) {
- msg->msg_type = IL_HTTP_POST;
- } else if(!strncasecmp(s, "GET", 3)) {
- msg->msg_type = IL_HTTP_GET;
- } else {
- msg->msg_type = IL_HTTP_OTHER;
- }
- if(msg->msg_type == IL_HTTP_REPLY) {
- char *p = strchr(s, ' ');
-
- if(!p) goto parse_end;
- p++;
- msg->reply_code=atoi(p);
- p = strchr(p, ' ');
- if(!p) goto parse_end;
- p++;
- msg->reply_string = strdup(p);
-
- parse_end:
- ;
- }
-}
-
-
-int
-parse_header(const char *s, il_http_message_t *msg)
-{
- if(!strncasecmp(s, "Content-Length:", 15)) {
- msg->content_length = atoi(s + 15);
- } else if(!strncasecmp(s, "Host:", 5)) {
- const char *p = s + 4;
- while(*++p == ' '); /* skip spaces */
- msg->host = strdup(p);
- }
- return(0);
-}
-
-
-#define DEFAULT_CHUNK_SIZE 1024
-
-// read what is available and parse what can be parsed
-// returns the result of read operation of the underlying connection,
-// ie. the number of bytes read or error code
-int
-receive_http(void *user_data, int (*reader)(void *, char *, const int), il_http_message_t *msg)
-{
- static enum { NONE, IN_REQUEST, IN_HEADERS, IN_BODY } state = NONE;
- int len, alen, clen, i, buffer_free, min_buffer_free = DEFAULT_CHUNK_SIZE;
- char *buffer, *p, *s, *cr;
-
- memset(msg, 0, sizeof(*msg));
- // msg->data = NULL;
- // msg->len = 0;
- state = IN_REQUEST;
- alen = 0;
- buffer = NULL;
- buffer_free = 0;
- p = NULL;
- s = NULL;
-
- do {
- /* p - first empty position in buffer
- alen - size of allocated buffer
- len - number of bytes received in last read
- s - points behind last scanned CRLF or at buffer start
- buffer_free = alen - (p - buffer)
- */
-
- /* prepare at least chunk_size bytes for next data */
- if(buffer_free < min_buffer_free) {
- char *n;
-
- alen += min_buffer_free;
- n = realloc(buffer, alen);
- if(n == NULL) {
- free(buffer);
- set_error(IL_NOMEM, ENOMEM, "read_event: no room for event");
- return(-1);
- }
- buffer_free += min_buffer_free;
- p = n + (p - buffer);
- s = n + (s - buffer);
- buffer = n;
- }
-
- if(buffer_free > 0) {
- len = (*reader)(user_data, p, buffer_free);
- if(len < 0) {
- // error
- free(buffer);
- // set_error(IL_SYS, errno, "receive_http: error reading data");
- return -1;
- } else if(len == 0) {
- // EOF
- free(buffer);
- set_error(IL_PROTO, errno, "receive_http: error reading data - premature EOF");
- return -1;
- }
- buffer_free -= len;
- p+= len;
- }
-
-
- switch(state) {
-
- // parse buffer, look for CRLFs
- // s - start scan position
- // p - start of current token
- // cr - current CRLF position
-
- case IN_REQUEST:
- if((s < p - 1) &&
- (cr = (char*)memchr(s, '\r', p - s - 1)) &&
- (cr[1] == '\n')) {
- *cr = 0;
- parse_request(s, msg);
- *cr = '\r';
- // change state
- state = IN_HEADERS;
- // start new tokens (cr < p - 1 -> s < p + 1 <-> s <= p)
- s = cr + 2;
- } else {
- break;
- }
-
- case IN_HEADERS:
- while((state != IN_BODY) &&
- (s < p - 1) &&
- (cr = (char*)memchr(s, '\r', p - s - 1)) &&
- (cr[1] == '\n')) {
- if(s == cr) { /* do not consider request starting with CRLF */
- // found CRLFCRLF
- state = IN_BODY;
- } else {
- *cr = 0;
- parse_header(s, msg);
- *cr = '\r';
- }
- // next scan starts after CRLF
- s = cr + 2;
- }
- if(state == IN_BODY) {
- // we found body
- // content-length should be set at the moment
- if(msg->content_length > 0) {
- int need_free = msg->content_length - (p - s);
- char *n;
-
- alen += need_free - buffer_free + 1;
- n = realloc(buffer, alen);
- if(n == NULL) {
- free(buffer);
- set_error(IL_NOMEM, ENOMEM, "read_event: no room for event");
- return(-1);
- }
- buffer_free = need_free;
- min_buffer_free = 0;
- p = n + (p - buffer);
- s = n + (s - buffer);
- buffer = n;
- } else {
- // report error
- free(buffer);
- set_error(IL_PROTO, EINVAL, "receive_http: error reading data - no content length specified\n");
- return -1;
- }
- }
- break;
-
- case IN_BODY:
- if(buffer_free == 0) {
- // finished reading
- *p = 0;
- state = NONE;
- }
- break;
- }
- } while(state != NONE);
-
- msg->data = buffer;
- msg->len = p - buffer;
-
- return 0;
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <netdb.h>
-#include <assert.h>
-#include <pthread.h>
-#include <stdlib.h>
-
-#ifdef LB_PROF
-#include <sys/gmon.h>
-extern void _start (void), etext (void);
-#endif
-
-#include "glite/security/glite_gss.h"
-
-#include "il_error.h"
-
-
-extern int log_level;
-
-static pthread_key_t err_key;
-
-static int IL_ERR_MSG_LEN = 1024;
-
-static
-void
-error_key_delete(void *err)
-{
- if(((struct error_inf*)err)->msg)
- free(((struct error_inf*)err)->msg);
- free(err);
-}
-
-static
-void
-error_key_create()
-{
- pthread_key_create(&err_key, error_key_delete);
-}
-
-static
-struct error_inf *
-error_get_err ()
-{
- struct error_inf *err;
-
- /* get thread specific error structure */
- err = (struct error_inf *)pthread_getspecific(err_key);
- assert(err != NULL);
-
- return(err);
-}
-
-
-int
-init_errors(int level)
-{
- static pthread_once_t error_once = PTHREAD_ONCE_INIT;
- struct error_inf *err;
-
- /* create the key for thread specific error only once */
- pthread_once(&error_once, error_key_create);
-
- /* there is no thread error yet, try to create one */
- if((err = (struct error_inf *)malloc(sizeof(*err)))) {
- /* allocation successfull, make it thread specific data */
- if(pthread_setspecific(err_key, err)) {
- free(err);
- return(-1);
- }
- } else
- return(-1);
-
- err->code_maj = 0;
- err->code_min = 0;
- err->msg = malloc(IL_ERR_MSG_LEN + 1);
- if(err->msg == NULL)
- return(-1);
-
- if(level)
- log_level = level;
-
-#ifdef LB_PROF
- monstartup((u_long)&_start, (u_long)&etext);
-#endif
-
- return(0);
-}
-
-int
-set_error(int code, long minor, char *msg)
-{
- struct error_inf *err;
-
- err = error_get_err();
-
- err->code_maj = code;
- err->code_min = minor;
-
- switch(code) {
-
- case IL_SYS:
- snprintf(err->msg, IL_ERR_MSG_LEN, "%s: %s", msg, strerror(err->code_min));
- break;
-
- case IL_HOST:
- snprintf(err->msg, IL_ERR_MSG_LEN, "%s: %s", msg, hstrerror(err->code_min));
- break;
-
- case IL_DGGSS:
- switch(err->code_min) {
-
- case EDG_WLL_GSS_ERROR_GSS:
- snprintf(err->msg, IL_ERR_MSG_LEN, "%s", msg);
- break;
-
- case EDG_WLL_GSS_ERROR_TIMEOUT:
- snprintf(err->msg, IL_ERR_MSG_LEN, "%s: Timeout in GSS connection.", msg);
- break;
-
- case EDG_WLL_GSS_ERROR_EOF:
- snprintf(err->msg, IL_ERR_MSG_LEN, "%s: Connection lost.", msg);
- break;
-
- case EDG_WLL_GSS_ERROR_ERRNO:
- snprintf(err->msg, IL_ERR_MSG_LEN, "%s: %s", msg, strerror(errno));
- break;
-
- case EDG_WLL_GSS_ERROR_HERRNO:
- snprintf(err->msg, IL_ERR_MSG_LEN, "%s: %s", msg, hstrerror(errno));
- break;
- }
-
- default:
- strncpy(err->msg, msg, IL_ERR_MSG_LEN);
- }
-
- err->msg[IL_ERR_MSG_LEN] = 0; /* OK, malloc()ed IL_ERR_MSG_LEN + 1 */
-
- return(code);
-}
-
-
-int
-clear_error() {
- struct error_inf *err;
-
- err = error_get_err();
-
- err->code_maj = IL_OK;
- err->code_min = 0;
- *(err->msg) = 0;
-
- return(0);
-}
-
-
-int
-error_get_maj()
-{
- struct error_inf *err;
-
- err = error_get_err();
-
- return(err->code_maj);
-}
-
-
-long
-error_get_min()
-{
- struct error_inf *err;
-
- err = error_get_err();
-
- return(err->code_min);
-}
-
-
-char *
-error_get_msg()
-{
- struct error_inf *err;
-
- err = error_get_err();
-
- return(err->msg);
-}
+++ /dev/null
-#ifndef IL_ERROR_H
-#define IL_ERROR_H
-
-#ident "$Header$"
-
-#include <syslog.h>
-
-enum err_code_maj { /* minor = */
- IL_OK, /* 0 */
- IL_SYS, /* errno */
- IL_NOMEM, /* ENOMEM */
- IL_PROTO, /* LB_* */
- IL_LBAPI, /* dgLBErrCode */
- IL_DGGSS, /* EDG_WLL_GSS_* */
- IL_HOST /* h_errno */
-};
-
-struct error_inf {
- int code_maj;
- long code_min;
- char *msg;
-};
-
-int init_errors(int);
-int set_error(int, long, char *);
-int clear_error();
-int error_get_maj();
-long error_get_min();
-char *error_get_msg();
-
-int il_log(int, char *, ...);
-
-#endif
+++ /dev/null
-#ident "$Header$"
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "glite/jobid/cjobid.h"
-#include "glite/lb/context.h"
-#include "glite/lb/events_parse.h"
-#include "glite/lb/il_string.h"
-
-#include "interlogd.h"
-
-#ifdef LB_PERF
-#include "glite/lb/lb_perftest.h"
-#endif
-
-static
-int
-cmp_jobid(struct server_msg *msg, void *data)
-{
- char *job_id_s = (char*)data;
- return strcmp(msg->job_id_s, job_id_s) == 0;
-}
-
-static
-int
-cmp_jobid_set_exp(struct server_msg *msg, void *data)
-{
- struct server_msg *m = (struct server_msg *)data;
-
- if(strcmp(msg->job_id_s, m->job_id_s) == 0) {
- msg->expires = m->expires;
- }
- return 0;
-}
-
-
-int
-enqueue_msg(struct event_queue *eq, struct server_msg *msg)
-{
-#if defined(IL_NOTIFICATIONS)
- struct event_queue *eq_known;
-
- /* now we have a new event with possibly changed destination,
- so check for the already known destination and possibly move
- events from the original output queue to a new one */
- eq_known = notifid_map_get_dest(msg->job_id_s);
- if(eq != eq_known) {
- /* client has changed delivery address for this notification */
- if(notifid_map_set_dest(msg->job_id_s, eq) < 0)
- return(-1);
- /* move all events with this notif_id from eq_known to eq */
- if(eq_known != NULL) {
- event_queue_move_events(eq_known, eq, cmp_jobid, msg->job_id_s);
- /* XXX - we should kill the old queue too */
- }
- }
-
- /* if the expiration changed, set new one */
- if(msg->expires != notifid_map_get_expiration(msg->job_id_s)) {
- notifid_map_set_expiration(msg->job_id_s, msg->expires);
- /* set expiration for all events with this notif id */
- event_queue_move_events(eq, NULL, cmp_jobid_set_exp, msg);
- }
-#endif
-
- /* fire thread to take care of this queue */
- if(event_queue_create_thread(eq) < 0)
- return(-1);
-
-#if defined(IL_NOTIFICATIONS)
- /* if there are no data to send, do not send anything
- (messsage was just to change the delivery address) */
- /* CORRECTION - let the message pass through the output queue
- to commit it properly and keep event_store in sync */
- /* if(msg->len == 0)
- return(0);
- */
-#endif
- /* avoid losing signal to thread */
- event_queue_cond_lock(eq);
-
- /* insert new event */
- if(event_queue_insert(eq, msg) < 0) {
- event_queue_cond_unlock(eq);
- return(-1);
- }
-
- /* signal thread that we have a new message */
- event_queue_signal(eq);
-
- /* allow thread to continue */
- event_queue_cond_unlock(eq);
-
- return(0);
-}
-
-
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
-pthread_mutex_t flush_lock = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t flush_cond = PTHREAD_COND_INITIALIZER;
-#endif /* INTERLOGD_FLUSH */
-
-#ifdef INTERLOGD_HANDLE_CMD
-static
-int
-parse_cmd(char *event, char **job_id_s, long *receipt, int *timeout)
-{
- char *token, *r;
- int ret;
-
- if(strstr(event, "DG.TYPE=\"command\"") == NULL)
- return(-1);
-
- *job_id_s = NULL;
- *timeout = 0;
- *receipt = 0;
- ret = 0;
-
- for(token = strtok(event, " "); token != NULL; token = strtok(NULL, " ")) {
- r = index(token, '=');
- if(r == NULL) {
- ret = -1;
- continue;
- }
- if(strncmp(token, "DG.COMMAND", r - token) == 0) {
-#if defined(INTERLOGD_FLUSH)
- if(strcmp(++r, "\"flush\"")) {
-#endif
- il_log(LOG_WARNING, " command %s not implemented\n", r);
- ret = -1;
- continue;
-#if defined(INTERLOGD_FLUSH)
- }
-#endif
- } else if(strncmp(token, "DG.JOBID", r - token) == 0) {
- char *p;
-
- r += 2; /* skip =" */
- p = index(r, '"');
- if(p == NULL) { ret = -1; continue; }
- *job_id_s = strndup(r, p-r);
-
- } else if(strncmp(token, "DG.TIMEOUT", r - token) == 0) {
- sscanf(++r, "\"%d\"", timeout);
- } else if(strncmp(token, "DG.LLLID", r - token) == 0) {
- sscanf(++r, "%ld", receipt);
- }
-
- }
- return(0);
-}
-
-
-/* return value:
- * 0 - not command
- * 1 - success
- * -1 - failure
- */
-
-static
-int
-handle_cmd(il_octet_string_t *event, long offset)
-{
- char *job_id_s;
- struct event_queue *eq;
- int num_replies, num_threads = 0;
- int timeout, result;
- long receipt;
- struct timespec endtime;
- struct timeval tv;
-
- /* parse command */
- if(parse_cmd(event->data, &job_id_s, &receipt, &timeout) < 0)
- return(0);
-
-#if defined(INTERLOGD_FLUSH)
- il_log(LOG_DEBUG, " received FLUSH command\n");
-
- /* catchup with all neccessary event files */
- if(job_id_s) {
- struct event_store *es = event_store_find(job_id_s, NULL);
-
- if(es == NULL) {
- goto cmd_error;
- }
- result = event_store_recover(es);
- /* NOTE: if flush had been stored in file, there would have been
- no need to lock the event_store at all */
- event_store_release(es);
- if(result < 0) {
- il_log(LOG_ERR, " error trying to catch up with event file: %s\n",
- error_get_msg());
- clear_error();
- }
- } else
- /* this call does not fail :-) */
- event_store_recover_all();
-
- il_log(LOG_DEBUG, " alerting threads to report status\n");
-
- /* prevent threads from reporting too early */
- if(pthread_mutex_lock(&flush_lock) < 0) {
- /*** this error is considered too serious to allow the program run anymore!
- set_error(IL_SYS, errno, "pthread_mutex_lock: error locking flush lock");
- goto cmd_error;
- */
- abort();
- }
-
- /* wake up all threads */
- if(job_id_s) {
- /* find appropriate queue */
- eq = queue_list_get(job_id_s);
- if(eq == NULL) goto cmd_error;
- if(!event_queue_empty(eq) && !queue_list_is_log(eq)) {
- num_threads++;
- event_queue_cond_lock(eq);
- eq->flushing = 1;
- event_queue_wakeup(eq);
- event_queue_cond_unlock(eq);
- }
- } else {
- /* iterate over event queues */
- for(eq=queue_list_first(); eq != NULL; eq=queue_list_next()) {
- if(!event_queue_empty(eq) && !queue_list_is_log(eq)) {
- num_threads++;
- event_queue_cond_lock(eq);
- eq->flushing = 1;
- event_queue_wakeup(eq);
- event_queue_cond_unlock(eq);
- }
- }
- }
- if(!bs_only) {
- eq = queue_list_get(NULL);
- if(eq == NULL) goto cmd_error;
- if(!event_queue_empty(eq)) {
- num_threads++;
- event_queue_cond_lock(eq);
- eq->flushing = 1;
- event_queue_wakeup(eq);
- event_queue_cond_unlock(eq);
- }
- }
-
- /* wait for thread replies */
- num_replies = 0;
- result = 1;
- gettimeofday(&tv, NULL);
- endtime.tv_sec = tv.tv_sec + timeout;
- endtime.tv_nsec = 1000 * tv.tv_usec;
- while(num_replies < num_threads) {
- int ret;
- if((ret=pthread_cond_timedwait(&flush_cond, &flush_lock, &endtime)) < 0) {
- il_log(LOG_ERR, " error waiting for thread reply: %s\n", strerror(errno));
- result = (ret == ETIMEDOUT) ? 0 : -1;
- break;
- }
-
- /* collect results from reporting threads */
- if(job_id_s) {
- /* find appropriate queue */
- eq = queue_list_get(job_id_s);
- if(eq == NULL) goto cmd_error;
- if(!queue_list_is_log(eq)) {
- event_queue_cond_lock(eq);
- if(eq->flushing == 2) {
- eq->flushing = 0;
- num_replies++;
- result = ((result == 1) || (eq->flush_result < 0)) ?
- eq->flush_result : result;
- }
- event_queue_cond_unlock(eq);
- }
- } else {
- /* iterate over event queues */
- for(eq=queue_list_first(); eq != NULL; eq=queue_list_next()) {
- if(!queue_list_is_log(eq)) {
- event_queue_cond_lock(eq);
- if(eq->flushing == 2) {
- eq->flushing = 0;
- num_replies++;
- il_log(LOG_DEBUG, " thread reply: %d\n", eq->flush_result);
- result = ((result == 1) || (eq->flush_result < 0)) ?
- eq->flush_result : result;
- }
- event_queue_cond_unlock(eq);
- }
- }
- }
- if(!bs_only) {
- eq = queue_list_get(NULL);
- if(eq == NULL) goto cmd_error;
- event_queue_cond_lock(eq);
- if(eq->flushing == 2) {
- eq->flushing = 0;
- num_replies++;
- result = ((result == 1) || (eq->flush_result < 0)) ?
- eq->flush_result : result;
- }
- event_queue_cond_unlock(eq);
- }
- }
-
- /* prevent deadlock in next flush */
- if(pthread_mutex_unlock(&flush_lock) < 0)
- abort();
-
-
- /* report back to local logger */
- switch(result) {
- case 1:
- result = 0; break;
- case 0:
- result = EDG_WLL_IL_EVENTS_WAITING; break;
- default:
- result = EDG_WLL_IL_SYS; break;
- }
- if(job_id_s) free(job_id_s);
- result = send_confirmation(receipt, result);
- if(result <= 0)
- il_log(LOG_ERR, "handle_cmd: error sending status: %s\n", error_get_msg());
- return(1);
-
-
-cmd_error:
- if(job_id_s) free(job_id_s);
- return(-1);
-#else
- return(0);
-#endif /* INTERLOGD_FLUSH */
-}
-#endif /* INTERLOGD_HANDLE_CMD */
-
-
-static
-int
-handle_msg(il_octet_string_t *event, long offset)
-{
- struct server_msg *msg = NULL;
-#if !defined(IL_NOTIFICATIONS)
- struct event_queue *eq_l;
-#endif
- struct event_queue *eq_s;
- struct event_store *es;
-
- int ret;
-
- /* convert event to message for server */
- if((msg = server_msg_create(event, offset)) == NULL) {
- il_log(LOG_ERR, " handle_msg: error parsing event '%s':\n %s\n", event, error_get_msg());
- return(0);
- }
-
- /* sync event store with IPC (if neccessary)
- * This MUST be called before inserting event into output queue! */
- if((es = event_store_find(msg->job_id_s, NULL)) == NULL)
- return(-1);
- msg->es = es;
-
-#ifdef LB_PERF
- if(nosync)
- ret = 1;
- else
-#endif
- ret = event_store_sync(es, offset);
- /* no longer informative:
- il_log(LOG_DEBUG, " syncing event store at %d with event at %d, result %d\n", es->offset, offset, ret);
- */
- if(ret < 0) {
- il_log(LOG_ERR, " handle_msg: error syncing event store:\n %s\n", error_get_msg());
- /* XXX should error during event store recovery cause us to drop the message? */
- /* Probably no, because the attempt to recover means we have missed some events,
- and delivery of this one will not move offset ahead. So try our best and deliver it
- even if it may cause duplicates on server. */
- /* COMMENTED OUT: uncommented again */
- server_msg_free(msg);
- event_store_release(es);
- return(0);
- /* */
- } else if(ret == 0) {
- /* we have seen this event already */
- server_msg_free(msg);
- event_store_release(es);
- return(1);
- }
-
- /* find apropriate queue for this event */
-#if defined(IL_NOTIFICATIONS)
- eq_s = queue_list_get(msg->dest);
-#else
- eq_s = queue_list_get(msg->job_id_s);
-#endif
- if(eq_s == NULL) {
- il_log(LOG_ERR, " handle_msg: apropriate queue not found: %s\n", error_get_msg());
- clear_error();
- } else {
- if(enqueue_msg(eq_s, msg) < 0)
- goto err;
- }
-
-#if !defined(IL_NOTIFICATIONS)
- eq_l = queue_list_get(NULL);
- if(!bs_only && eq_l != eq_s) {
- /* send to default queue (logging server) as well */
- if(enqueue_msg(eq_l, msg) < 0)
- goto err;
- }
-#endif
-
- /* if there was no error, set the next expected event offset */
- event_store_next(es, offset, msg->ev_len);
-
- /* allow cleanup thread to check on this event_store */
- event_store_release(es);
-
- /* free the message */
- server_msg_free(msg);
- return(1);
-
-err:
- event_store_release(es);
- server_msg_free(msg);
- return(-1);
-}
-
-
-
-int
-loop()
-{
- /* receive events */
- while(1) {
- il_octet_string_t *msg;
- long offset;
- int ret;
-
- if(killflg)
- exit(0);
-
- clear_error();
- if((ret = input_queue_get(&msg, &offset, INPUT_TIMEOUT)) < 0)
- {
- if(error_get_maj() == IL_PROTO) {
- il_log(LOG_DEBUG, " premature EOF while receiving event\n");
- /* problems with socket input, try to catch up from files */
-#ifndef PERF_EMPTY
- event_store_recover_all();
-#endif
- continue;
- } else
- return(-1);
- }
- else if(ret == 0) {
- continue;
- }
-
-#ifdef PERF_EMPTY
- glite_wll_perftest_consumeEventString(msg->data);
- free(msg->data);
- continue;
-#endif
-
-#ifdef INTERLOGD_HANDLE_CMD
- ret = handle_cmd(msg, offset);
- if(ret == 0)
-#endif
- ret = handle_msg(msg, offset);
- if(msg->data) free(msg->data);
- if(ret < 0)
- switch (error_get_maj()) {
- case IL_SYS:
- case IL_NOMEM:
- return (ret);
- break;
- default:
- il_log(LOG_ERR, "Error: %s\n", error_get_msg());
- break;
- }
- } /* while */
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-
-#include "interlogd.h"
-
-
-static const int SOCK_QUEUE_MAX = 50;
-extern char *socket_path;
-
-static int sock;
-static int accepted;
-
-int
-input_queue_attach()
-{
- struct sockaddr_un saddr;
-
- if((sock=socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- set_error(IL_SYS, errno, "input_queue_attach: error creating socket");
- return(-1);
- }
-
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, socket_path);
-
- /* test for the presence of the socket and another instance
- of interlogger listening */
- if(connect(sock, (struct sockaddr *)&saddr, sizeof(saddr.sun_path)) < 0) {
- if(errno == ECONNREFUSED) {
- /* socket present, but no one at the other end; remove it */
- il_log(LOG_WARNING, " removing stale input socket %s\n", socket_path);
- unlink(socket_path);
- }
- /* ignore other errors for now */
- } else {
- /* connection was successful, so bail out - there is
- another interlogger running */
- set_error(IL_SYS, EADDRINUSE, "input_queue_attach: another instance of interlogger is running");
- return(-1);
- }
-
- if(bind(sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
- set_error(IL_SYS, errno, "input_queue_attach: error binding socket");
- return(-1);
- }
-
- if (listen(sock, SOCK_QUEUE_MAX)) {
- set_error(IL_SYS, errno, "input_queue_attach: error listening on socket");
- return -1;
- }
-
- return(0);
-}
-
-void input_queue_detach()
-{
- if (sock >= 0)
- close(sock);
- unlink(socket_path);
-}
-
-
-#define DEFAULT_CHUNK_SIZE 1024
-
-static
-int
-read_event(int sock, long *offset, il_octet_string_t *msg)
-{
- char *buffer, *p, *n;
- int len, alen, i, chunk_size = DEFAULT_CHUNK_SIZE;
- static char buf[1024];
-
- msg->data = NULL;
- msg->len = 0;
-
- /* receive offset */
- len = recv(sock, offset, sizeof(*offset), MSG_NOSIGNAL);
- if(len < sizeof(*offset)) {
- set_error(IL_PROTO, errno, "read_event: error reading offset");
- return(-1);
- }
-
- /* receive event string */
- buffer=malloc(8*chunk_size);
- if(buffer == NULL) {
- set_error(IL_NOMEM, ENOMEM, "read_event: no room for event");
- return(-1);
- }
- p = buffer;
- alen = 8*chunk_size;
-
- /* Variables used here:
- - buffer points to allocated memory,
- - alen is the allocated memory size,
- - p points to the first free location in buffer,
- - len is the amount actually read by recv,
- - i is the amount of data belonging to the current event (including separator).
- - n points to event separator or is NULL
- Hence:
- (p - buffer) gives the amount of valid data read so far,
- (alen - (p - buffer)) is the free space,
- */
-
-#if 1
- /* Reading events - optimized version. Attempts to increase chunks read by recv
- * when there are more data, reads directly into destination memory (instead of
- * copying from static buffer) etc.
- *
- * For some reason it is not much faster than the old variant.
- */
- do {
- /* prepare at least chunk_size bytes for next data */
- if(alen - (p - buffer) < chunk_size) {
- alen += (chunk_size < 8192) ? 8192 : 8*chunk_size;
- n = realloc(buffer, alen);
- if(n == NULL) {
- free(buffer);
- set_error(IL_NOMEM, ENOMEM, "read_event: no room for event");
- return(-1);
- }
- p = n + (p - buffer);
- buffer = n;
- }
-
- /* read chunk */
- if((len=recv(sock, p, chunk_size, MSG_PEEK | MSG_NOSIGNAL)) > 0) {
- /* find the end of event, if any */
- /* faster (and dirty) way of doing strnchr (which is not in libc, anyway) */
- if((n=memccpy(p, p, EVENT_SEPARATOR, len)) != NULL) {
- i = n - p; /* length including separator */
- } else {
- i = len;
- /* long event, huh? try reading more data at once */
- chunk_size += 1024;
- }
- /* remove the relevant data from input */
- /* i > 0 */
- if(recv(sock, p, i, MSG_NOSIGNAL) != i) {
- set_error(IL_SYS, errno, "read_event: error reading data");
- free(buffer);
- return(-1);
- }
- /* move the pointer to the first free place, separator is considered free space */
- p = (n == NULL) ? p + len : n - 1;
- }
- } while ( (len > 0) && (n == NULL) );
-
-#else
- /* Reading events - original version.
- * Appears to behave quite good, anyway.
- */
- while((len=recv(sock, buf, sizeof(buf), MSG_PEEK | MSG_NOSIGNAL)) > 0) {
-
- /* we have to be prepared for sizeof(buf) bytes */
- if(alen - (p - buffer) < (int)sizeof(buf)) {
- alen += 8192;
- n = realloc(buffer, alen);
- if(n == NULL) {
- free(buffer);
- set_error(IL_NOMEM, ENOMEM, "read_event: no room for event");
- return(-1);
- }
- p = p - buffer + n;
- buffer = n;
- }
-
- /* copy all relevant bytes from buffer */
- n = (char*)memccpy(p, buf, EVENT_SEPARATOR, len);
- if(n) {
- /* separator found */
- n--; /* but do not preserve it */
- i = n - p;
- p = n;
- } else {
- /* separator not found */
- i = len;
- p += len;
- }
- /* This was definitely slowing us down:
- * for(i=0; (i < len) && (buf[i] != EVENT_SEPARATOR); i++)
- * *p++ = buf[i];
- */
-
- /* remove the data from queue */
- if(i > 0)
- if(recv(sock, buf, i, MSG_NOSIGNAL) != i) {
- set_error(IL_SYS, errno, "read_event: error reading data");
- free(buffer);
- return(-1);
- }
- if(i < len)
- /* the event is complete */
- break;
- }
-#endif
-
- /* terminate buffer */
- *p = 0;
-
- if(len < 0) {
- set_error(IL_SYS, errno, "read_event: error reading data");
- free(buffer);
- return(-1);
- }
-
- /* if len == 0, we have not encountered EVENT_SEPARATOR and thus the event is not complete */
- if(len == 0) {
- set_error(IL_PROTO, errno, "read_event: error reading data - premature EOF");
- free(buffer);
- return(-1);
- }
-
-#if 0
- /* this is probably not necessary at all:
- either len <=0, which was covered before,
- or 0 <= i < len => p > buffer;
- I would say this condition can not be satisfied.
- */
- if(p == buffer) {
- set_error(IL_PROTO, errno, "read_event: error reading data - no data received");
- free(buffer);
- return(-1);
- }
-#endif
-
- msg->data = buffer;
- msg->len = p - buffer;
- return(msg->len);
-}
-
-
-/*
- * Returns: -1 on error, 0 if no message available, message length otherwise
- *
- */
-#ifdef PERF_EVENTS_INLINE
-int
-input_queue_get(il_octet_string **buffer, long *offset, int timeout)
-{
- static long o = 0;
- int len;
- char *jobid;
- static il_octet_string_t my_buffer;
-
- assert(buffer != NULL);
-
- *buffer = &my_buffer;
-
- len = glite_wll_perftest_produceEventString(&my_buffer.data, &jobid);
- my_buffer.len = len;
- if(len) {
- o += len;
- *offset = o;
- } else if (len == 0) {
- sleep(timeout);
- }
- return(len);
-}
-#else
-int
-input_queue_get(il_octet_string_t **buffer, long *offset, int timeout)
-{
- fd_set fds;
- struct timeval tv;
- int msg_len;
- static il_octet_string_t my_buffer;
-
- assert(buffer != NULL);
-
- *buffer = &my_buffer;
-
- FD_ZERO(&fds);
- FD_SET(sock, &fds);
-
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
-
- msg_len = select(sock + 1, &fds, NULL, NULL, timeout >= 0 ? &tv : NULL);
- switch(msg_len) {
-
- case 0: /* timeout */
- return(0);
-
- case -1: /* error */
- switch(errno) {
- case EINTR:
- il_log(LOG_DEBUG, " interrupted while waiting for event!\n");
- return(0);
-
- default:
- set_error(IL_SYS, errno, "input_queue_get: error waiting for event");
- return(-1);
- }
- default:
- break;
- }
-
- if((accepted=accept(sock, NULL, NULL)) < 0) {
- set_error(IL_SYS, errno, "input_queue_get: error accepting connection");
- return(-1);
- }
-
- read_event(accepted, offset, &my_buffer);
- close(accepted);
-
- if(my_buffer.data == NULL) {
- if(error_get_maj() != IL_OK)
- return(-1);
- else
- return(0);
- }
-
- return(my_buffer.len);
-}
-#endif
+++ /dev/null
-#ident "$Header$"
-
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "interlogd.h"
-
-static const int SOCK_QUEUE_MAX = 50;
-extern char *socket_path;
-extern char *file_prefix;
-
-static int sock;
-static int accepted;
-
-static
-int plain_reader(void *user_data, char *buffer, const int len)
-{
- return (recv(*(int*)user_data, buffer, len, MSG_NOSIGNAL));
-}
-
-
-int
-input_queue_attach()
-{
- struct sockaddr_un saddr;
-
- if((sock=socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- set_error(IL_SYS, errno, "input_queue_attach: error creating socket");
- return(-1);
- }
-
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, socket_path);
-
- /* test for the presence of the socket and another instance
- of interlogger listening */
- if(connect(sock, (struct sockaddr *)&saddr, sizeof(saddr.sun_path)) < 0) {
- if(errno == ECONNREFUSED) {
- /* socket present, but no one at the other end; remove it */
- il_log(LOG_WARNING, " removing stale input socket %s\n", socket_path);
- unlink(socket_path);
- }
- /* ignore other errors for now */
- } else {
- /* connection was successful, so bail out - there is
- another interlogger running */
- set_error(IL_SYS, EADDRINUSE, "input_queue_attach: another instance of interlogger is running");
- return(-1);
- }
-
- if(bind(sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
- set_error(IL_SYS, errno, "input_queue_attach: error binding socket");
- return(-1);
- }
-
- if (listen(sock, SOCK_QUEUE_MAX)) {
- set_error(IL_SYS, errno, "input_queue_attach: error listening on socket");
- return -1;
- }
-
- return(0);
-}
-
-
-void input_queue_detach()
-{
- if (sock >= 0)
- close(sock);
- unlink(socket_path);
-}
-
-
-
-/*
- * Returns: -1 on error, 0 if no message available, message length otherwise
- *
- */
-#ifdef PERF_EVENTS_INLINE
-int
-input_queue_get(il_octet_string_t **buffer, long *offset, int timeout)
-{
- static long o = 0;
- int len;
- char *jobid;
- static il_octet_string_t my_buffer;
-
- assert(buffer != NULL);
-
- *buffer = &my_buffer;
-
- len = glite_wll_perftest_produceEventString(&my_buffer.data, &jobid);
- my_buffer.len = len;
- if(len) {
- o += len;
- *offset = o;
- } else if (len == 0) {
- sleep(timeout);
- }
- return(len);
-}
-#else
-int
-input_queue_get(il_octet_string_t **buffer, long *offset, int timeout)
-{
- fd_set fds;
- struct timeval tv;
- int msg_len;
- static il_http_message_t msg;
-
- assert(buffer != NULL);
-
- *buffer = (il_octet_string_t *)&msg;
-
- FD_ZERO(&fds);
- FD_SET(sock, &fds);
-
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
-
- msg_len = select(sock + 1, &fds, NULL, NULL, timeout >= 0 ? &tv : NULL);
- switch(msg_len) {
-
- case 0: /* timeout */
- return(0);
-
- case -1: /* error */
- switch(errno) {
- case EINTR:
- il_log(LOG_DEBUG, " interrupted while waiting for event!\n");
- return(0);
-
- default:
- set_error(IL_SYS, errno, "input_queue_get: error waiting for event");
- return(-1);
- }
- default:
- break;
- }
-
- if((accepted=accept(sock, NULL, NULL)) < 0) {
- set_error(IL_SYS, errno, "input_queue_get: error accepting connection");
- return(-1);
- }
-
- msg_len = receive_http(&accepted, plain_reader, &msg);
-
- if(msg_len < 0) {
- close(accepted);
- if(error_get_maj() != IL_OK)
- return -1;
- else
- return 0;
- }
-
- close(accepted);
- *offset = -1;
- return(msg.len);
-}
-#endif
-
+++ /dev/null
-#ident "$Header$"
-
-/*
- interlogger - collect events from local-logger and send them to logging and bookkeeping servers
-
-*/
-#include <stdio.h>
-#include <getopt.h>
-#include <string.h>
-#include <signal.h>
-#include <pthread.h>
-#include <errno.h>
-
-#include "interlogd.h"
-#include "glite/lb/log_proto.h"
-#include "glite/security/glite_gss.h"
-#ifdef LB_PERF
-#include "glite/lb/lb_perftest.h"
-#endif
-
-#define EXIT_FAILURE 1
-#if defined(IL_NOTIFICATIONS)
-#define DEFAULT_PREFIX "/tmp/notif_events"
-#define DEFAULT_SOCKET "/tmp/notif_interlogger.sock"
-#else
-#define DEFAULT_PREFIX EDG_WLL_LOG_PREFIX_DEFAULT
-#define DEFAULT_SOCKET "/tmp/interlogger.sock"
-#endif
-
-
-/* The name the program was run with, stripped of any leading path. */
-char *program_name;
-int killflg = 0;
-
-int TIMEOUT = DEFAULT_TIMEOUT;
-
-cred_handle_t *cred_handle = NULL;
-pthread_mutex_t cred_handle_lock = PTHREAD_MUTEX_INITIALIZER;
-
-time_t key_mtime = 0, cert_mtime = 0;
-
-static void usage (int status)
-{
- printf("%s - \n"
- " collect events from local-logger and send them to logging and bookkeeping servers\n"
- "Usage: %s [OPTION]... [FILE]...\n"
- "Options:\n"
- " -h, --help display this help and exit\n"
- " -V, --version output version information and exit\n"
- " -d, --debug do not run as daemon\n"
- " -v, --verbose print extensive debug output\n"
- " -f, --file-prefix <prefix> path and prefix for event files\n"
- " -c, --cert <file> location of server certificate\n"
- " -k, --key <file> location of server private key\n"
- " -C, --CAdir <dir> directory containing CA certificates\n"
- " -b, --book send events to bookkeeping server only\n"
- " -l, --log-server <host> specify address of log server\n"
- " -s, --socket <path> non-default path of local socket\n"
- " -L, --lazy [<timeout>] be lazy when closing connections to servers (default, timeout==0 means turn lazy off)\n"
- " -p, --parallel [<num>] use <num> parallel streams to the same server\n"
-#ifdef LB_PERF
- " -n, --nosend PERFTEST: consume events instead of sending\n"
- " -S, --nosync PERFTEST: do not check logd files for lost events\n"
- " -R, --norecover PERFTEST: do not start recovery thread\n"
- " -P, --noparse PERFTEST: do not parse messages, use built-in server address\n"
-#ifdef PERF_EVENTS_INLINE
- " -e, --event_file <file> PERFTEST: file to read test events from\n"
- " -j, --njobs <n> PERFTEST: number of jobs to send\n"
-#endif
-#endif
- , program_name, program_name);
- exit(status);
-}
-
-
-/* Option flags and variables */
-static int debug;
-static int verbose = 0;
-char *file_prefix = DEFAULT_PREFIX;
-int bs_only = 0;
-int lazy_close = 1;
-int default_close_timeout;
-size_t max_store_size;
-int parallel = 0;
-#ifdef LB_PERF
-int nosend = 0, norecover=0, nosync=0, noparse=0;
-char *event_source = NULL;
-int njobs = 0;
-#endif
-
-char *cert_file = NULL;
-char *key_file = NULL;
-char *CAcert_dir = NULL;
-char *log_server = NULL;
-char *socket_path = DEFAULT_SOCKET;
-
-static struct option const long_options[] =
-{
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'V'},
- {"verbose", no_argument, 0, 'v'},
- {"debug", no_argument, 0, 'd'},
- {"file-prefix", required_argument, 0, 'f'},
- {"cert", required_argument, 0, 'c'},
- {"key", required_argument, 0, 'k'},
- {"book", no_argument, 0, 'b'},
- {"CAdir", required_argument, 0, 'C'},
- {"log-server", required_argument, 0, 'l'},
- {"socket", required_argument, 0, 's'},
- {"lazy", optional_argument, 0, 'L'},
- {"max-store", required_argument, 0, 'M'},
- {"parallel", optional_argument, 0, 'p'},
-#ifdef LB_PERF
- {"nosend", no_argument, 0, 'n'},
- {"nosync", no_argument, 0, 'S'},
- {"norecover", no_argument, 0, 'R'},
- {"noparse", no_argument, 0, 'P'},
-#ifdef PERF_EVENTS_INLINE
- {"event_file", required_argument, 0, 'e'},
- {"njobs", required_argument, NULL, 'j'},
-#endif
-#endif
- {NULL, 0, NULL, 0}
-};
-
-
-
-/* Set all the option flags according to the switches specified.
- Return the index of the first non-option argument. */
-static int
-decode_switches (int argc, char **argv)
-{
- int c;
-
- debug = 0;
-
- while ((c = getopt_long (argc, argv,
- "f:" /* file prefix */
- "h" /* help */
- "V" /* version */
- "v" /* verbose */
- "c:" /* certificate */
- "k:" /* key */
- "C:" /* CA dir */
- "b" /* only bookeeping */
- "l:" /* log server */
- "d" /* debug */
- "p" /* parallel */
-#ifdef LB_PERF
- "n" /* nosend */
- "S" /* nosync */
- "R" /* norecover */
- "P" /* noparse */
-#ifdef PERF_EVENTS_INLINE
- "e:" /* event file */
- "j:" /* num jobs */
-#endif
-#endif
- "L::" /* lazy */
- "s:" /* socket */
- "M:" /* max-store */,
- long_options, (int *) 0)) != EOF)
- {
- switch (c)
- {
- case 'V':
- printf ("interlogger %s\n", VERSION);
- exit (0);
-
- case 'v':
- verbose = 1;
- break;
-
- case 'h':
- usage (0);
-
- case 'd':
- debug = 1;
- break;
-
- case 'f':
- file_prefix = strdup(optarg);
- break;
-
- case 'c':
- cert_file = strdup(optarg);
- break;
-
- case 'k':
- key_file = strdup(optarg);
- break;
-
- case 'b':
- bs_only = 1;
- break;
-
- case 'l':
- log_server = strdup(optarg);
- break;
-
- case 'C':
- CAcert_dir = strdup(optarg);
- break;
-
- case 's':
- socket_path = strdup(optarg);
- break;
-
- case 'L':
- lazy_close = 1;
- if(optarg)
- default_close_timeout = atoi(optarg);
- if(default_close_timeout == 0) {
- default_close_timeout = TIMEOUT;
- lazy_close = 0;
- }
- else
- default_close_timeout = TIMEOUT;
- break;
-
- case 'M':
- max_store_size = atoi(optarg);
- break;
-
- case 'p':
- if(optarg)
- parallel = atoi(optarg);
- else
- parallel = 4;
- break;
-
-#ifdef LB_PERF
- case 'n':
- nosend = 1;
- break;
-
- case 'R':
- norecover = 1;
- break;
-
- case 'S':
- nosync = 1;
- break;
-
- case 'P':
- noparse = 1;
- break;
-
-#ifdef PERF_EVENTS_INLINE
- case 'e':
- event_source = strdup(optarg);
- break;
-
- case 'j':
- njobs = atoi(optarg);
- break;
-#endif
-#endif
-
- default:
- usage (EXIT_FAILURE);
- }
- }
-
- return optind;
-}
-
-
-void handle_signal(int num) {
- il_log(LOG_DEBUG, "Received signal %d\n", num);
- killflg++;
-}
-
-
-int
-main (int argc, char **argv)
-{
- int i;
- char *p;
- edg_wll_GssStatus gss_stat;
- int ret;
-
- program_name = argv[0];
-
- setlinebuf(stdout);
- setlinebuf(stderr);
-
- if ((p = getenv("EDG_WL_INTERLOG_TIMEOUT"))) TIMEOUT = atoi(p);
-
- i = decode_switches (argc, argv);
-
- /* force -b if we do not have log server */
- if(log_server == NULL) {
- log_server = strdup(DEFAULT_LOG_SERVER);
- bs_only = 1;
- }
-
- if(init_errors(verbose ? LOG_DEBUG : LOG_WARNING)) {
- fprintf(stderr, "Failed to initialize error message subsys. Exiting.\n");
- exit(EXIT_FAILURE);
- }
-
- if (signal(SIGPIPE, SIG_IGN) == SIG_ERR
- || signal(SIGABRT, handle_signal) == SIG_ERR
- || signal(SIGTERM, handle_signal) == SIG_ERR
- || signal(SIGINT, handle_signal) == SIG_ERR) {
- perror("signal");
- exit(EXIT_FAILURE);
- }
-
- if(!debug &&
- (daemon(0,0) < 0)) {
- perror("daemon");
- exit(EXIT_FAILURE);
- }
-
-#ifdef LB_PERF
- /* this must be called after installing signal handlers */
- glite_wll_perftest_init(NULL, /* host */
- NULL, /* user */
- NULL, /* test name */
- event_source,
- njobs);
-#endif
-
- il_log(LOG_INFO, "Initializing input queue...\n");
- if(input_queue_attach() < 0) {
- il_log(LOG_CRIT, "Failed to initialize input queue: %s\n", error_get_msg());
- exit(EXIT_FAILURE);
- }
-
- /* initialize output queues */
- il_log(LOG_INFO, "Initializing event queues...\n");
- if(queue_list_init(log_server) < 0) {
- il_log(LOG_CRIT, "Failed to initialize output event queues: %s\n", error_get_msg());
- exit(EXIT_FAILURE);
- }
- if(lazy_close)
- il_log(LOG_DEBUG, " using lazy mode when closing connections, timeout %d\n",
- default_close_timeout);
-
- /* get credentials */
- if (CAcert_dir)
- setenv("X509_CERT_DIR", CAcert_dir, 1);
- edg_wll_gss_watch_creds(cert_file,&cert_mtime);
- cred_handle = malloc(sizeof(*cred_handle));
- if(cred_handle == NULL) {
- il_log(LOG_CRIT, "Failed to allocate structure for credentials.\n");
- exit(EXIT_FAILURE);
- }
- cred_handle->creds = NULL;
- cred_handle->counter = 0;
- ret = edg_wll_gss_acquire_cred_gsi(cert_file, key_file, &cred_handle->creds, &gss_stat);
- if (ret) {
- char *gss_err = NULL;
- char *str;
-
- if (ret == EDG_WLL_GSS_ERROR_GSS)
- edg_wll_gss_get_error(&gss_stat, "edg_wll_gss_acquire_cred_gsi()", &gss_err);
- asprintf(&str, "Failed to load GSI credential: %s\n",
- (gss_err) ? gss_err : "edg_wll_gss_acquire_cred_gsi() failed");
- il_log(LOG_CRIT, str);
- free(str);
- if (gss_err)
- free(gss_err);
- exit(EXIT_FAILURE);
- }
-
-#ifndef PERF_EMPTY
- /* find all unsent events waiting in files */
-#ifdef LB_PERF
- if(norecover) {
- if(event_store_init(file_prefix) < 0) {
- il_log(LOG_CRIT, "Failed to init event stores: %s\n", error_get_msg());
- exit(EXIT_FAILURE);
- }
- } else
-#endif
- {
- pthread_t rid;
-
- il_log(LOG_INFO, "Starting recovery thread...\n");
- if(pthread_create(&rid, NULL, recover_thread, NULL) < 0) {
- il_log(LOG_CRIT, "Failed to start recovery thread: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
- pthread_detach(rid);
- }
-#endif
-
- il_log(LOG_INFO, "Entering main loop...\n");
-
- /* do the work */
- if(loop() < 0) {
- il_log(LOG_CRIT, "Fatal error: %s\n", error_get_msg());
- if (killflg) {
- input_queue_detach();
- exit(EXIT_FAILURE);
- }
- }
- il_log(LOG_INFO, "Done!\n");
- input_queue_detach();
-
- exit (0);
-}
+++ /dev/null
-#ifndef INTERLOGGER_P_H
-#define INTERLOGGER_P_H
-
-#ident "$Header$"
-
-#include "il_error.h"
-#include "glite/security/glite_gss.h"
-#include "glite/lb/il_msg.h"
-
-#include <pthread.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#ifdef HAVE_DMALLOC_H
-#include <dmalloc.h>
-#endif
-
-#define INTERLOGD_HANDLE_CMD
-#define INTERLOGD_FLUSH
-#define INTERLOGD_EMS
-
-#define DEFAULT_USER "michal"
-#define DEFAULT_LOG_SERVER "localhost"
-#define DEFAULT_TIMEOUT 60
-
-#ifdef LB_PERF
-#include "glite/lb/lb_perftest.h"
-#endif
-
-#if defined(IL_NOTIFICATIONS)
-
-#include "glite/lb/notifid.h"
-
-#undef INTERLOGD_HANDLE_CMD
-#undef INTERLOGD_FLUSH
-#undef INTERLOGD_EMS
-#define IL_EVENT_ID_T edg_wll_NotifId
-#define IL_EVENT_GET_UNIQUE(a) edg_wll_NotifIdGetUnique((a))
-#define IL_EVENT_ID_FREE(a) edg_wll_NotifIdFree((a))
-#define IL_EVENT_ID_PARSE(a,b) edg_wll_NotifIdParse((a),(b))
-
-#else
-
-#define INTERLOGD_HANDLE_CMD
-#define INTERLOGD_FLUSH
-#define INTERLOGD_EMS
-#define IL_EVENT_ID_T edg_wlc_JobId
-#define IL_EVENT_GET_UNIQUE(a) edg_wlc_JobIdGetUnique((a))
-#define IL_EVENT_ID_FREE(a) edg_wlc_JobIdFree((a))
-#define IL_EVENT_ID_PARSE(a,b) edg_wlc_JobIdParse((a),(b))
-
-#endif
-
-
-#define EVENT_SEPARATOR '\n'
-
-// #define TIMEOUT 5
-extern int TIMEOUT;
-#define INPUT_TIMEOUT (60)
-#define EXIT_TIMEOUT (1*60)
-
-typedef struct cred_handle {
- edg_wll_GssCred creds;
- int counter;
-} cred_handle_t;
-extern cred_handle_t *cred_handle;
-
-extern pthread_mutex_t cred_handle_lock;
-extern pthread_key_t cred_handle_key;
-extern char *cert_file;
-extern char *key_file;
-extern char *CAcert_dir;
-extern int bs_only;
-extern int killflg;
-extern int lazy_close;
-extern int default_close_timeout;
-extern size_t max_store_size;
-extern int parallel;
-#ifdef LB_PERF
-extern int nosend, nosync, norecover, noparse;
-#ifdef PERF_EVENTS_INLINE
-extern char *event_source;
-#endif
-#endif
-
-/* shared data for thread communication */
-#ifdef INTERLOGD_FLUSH
-extern pthread_mutex_t flush_lock;
-extern pthread_cond_t flush_cond;
-#endif
-
-typedef struct {
- /* il_octet_string_t */
- int len;
- char *data;
- /* http message specific */
- enum { IL_HTTP_OTHER,
- IL_HTTP_GET,
- IL_HTTP_POST,
- IL_HTTP_REPLY
- } msg_type;
- int reply_code;
- char *reply_string;
- size_t content_length;
- char *host;
-} il_http_message_t;
-
-/* this struct can be passed instead of il_octet_string as parameter */
-typedef union {
- il_octet_string_t bin_msg;
- il_http_message_t http_msg;
-} il_message_t;
-
-
-struct event_store {
- char *event_file_name; /* file with events from local logger */
- char *control_file_name; /* file with control information */
- char *job_id_s; /* string form of the job id */
- long last_committed_bs; /* offset behind event that was last committed by BS */
- long last_committed_ls; /* -"- LS */
- long offset; /* expected file position of next event */
- time_t last_modified; /* time of the last file modification */
- int generation; /* cleanup counter, scopes the offset */
- long long rotate_index; /* rotation counter */
- struct event_store_list *le; /* points back to the list */
- pthread_rwlock_t commit_lock; /* lock to prevent simultaneous updates to last_committed_* */
- pthread_rwlock_t offset_lock; /* lock to prevent simultaneous updates offset */
- pthread_rwlock_t use_lock; /* lock to prevent struct deallocation */
-#if defined(IL_NOTIFICATIONS)
- char *dest; /* host:port destination */
-#endif
-};
-
-
-struct server_msg {
- char *job_id_s; /* necessary for commit */
- long offset; /* just for printing more information to debug */
- char *msg;
- int len;
- int ev_len;
- struct event_store *es; /* cache for corresponding event store */
- int generation; /* event store genereation */
- long receipt_to; /* receiver (long local-logger id - LLLID) of delivery confirmation (for priority messages) */
-#if defined(IL_NOTIFICATIONS)
- char *dest_name;
- int dest_port;
- char *dest;
-#endif
- time_t expires; /* time (in seconds from epoch) the message expires */
-};
-
-
-struct event_queue {
- edg_wll_GssConnection gss; /* GSS connection */
- char *dest_name;
- int dest_port;
- int timeout; /* queue timeout */
- struct event_queue_msg *tail; /* last message in the queue */
- struct event_queue_msg *head; /* first message in the queue */
-#if defined(INTERLOGD_EMS)
- struct event_queue_msg *tail_ems; /* last priority message in the queue (or NULL) */
- struct event_queue_msg *mark_this; /* mark message for removal */
- struct event_queue_msg *mark_prev; /* predecessor of the marked message */
-#endif
- pthread_t thread_id; /* id of associated thread */
- pthread_rwlock_t update_lock; /* mutex for queue updates */
- pthread_mutex_t cond_lock; /* mutex for condition variable */
- pthread_cond_t ready_cond; /* condition variable for message arrival */
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
- int flushing;
- int flush_result; /* result of flush operation */
- pthread_cond_t flush_cond; /* condition variable for flush operation */
-#endif
- /* statistics */
- int times_empty; /* number of times the queue was emptied */
- int max_len; /* max queue length */
- int cur_len; /* current length */
-};
-
-
-/* credential destructor */
-void cred_handle_destroy(void *);
-
-/* server msg methods */
-struct server_msg *server_msg_create(il_octet_string_t *, long);
-struct server_msg *server_msg_copy(struct server_msg *);
-int server_msg_init(struct server_msg *, il_octet_string_t *);
-#if defined(INTERLOGD_EMS)
-int server_msg_is_priority(struct server_msg *);
-#endif
-int server_msg_free(struct server_msg *);
-
-/* general event queue methods */
-struct event_queue *event_queue_create(char *);
-int event_queue_free(struct event_queue *);
-int event_queue_empty(struct event_queue *);
-int event_queue_insert(struct event_queue *, struct server_msg *);
-int event_queue_get(struct event_queue *, struct server_msg **);
-int event_queue_remove(struct event_queue *);
-int event_queue_enqueue(struct event_queue *, char *);
-/* helper */
-int enqueue_msg(struct event_queue *, struct server_msg *);
-int event_queue_move_events(struct event_queue *, struct event_queue *, int (*)(struct server_msg *, void *), void *);
-
-/* protocol event queue methods */
-int event_queue_connect(struct event_queue *);
-int event_queue_send(struct event_queue *);
-int event_queue_close(struct event_queue *);
-int send_confirmation(long, int);
-
-/* thread event queue methods */
-int event_queue_create_thread(struct event_queue *);
-int event_queue_lock(struct event_queue *);
-int event_queue_unlock(struct event_queue *);
-int event_queue_lock_ro(struct event_queue *);
-int event_queue_signal(struct event_queue *);
-int event_queue_wait(struct event_queue *, int);
-int event_queue_sleep(struct event_queue *);
-int event_queue_wakeup(struct event_queue *);
-int event_queue_cond_lock(struct event_queue *);
-int event_queue_cond_unlock(struct event_queue *);
-
-/* input queue */
-int input_queue_attach();
-void input_queue_detach();
-int input_queue_get(il_octet_string_t **, long *, int);
-
-/* queue management functions */
-int queue_list_init(char *);
-struct event_queue *queue_list_get(char *);
-struct event_queue *queue_list_first();
-struct event_queue *queue_list_next();
-int queue_list_is_log(struct event_queue *);
-
-#if defined(IL_NOTIFICATIONS)
-struct event_queue *notifid_map_get_dest(const char *);
-int notifid_map_set_dest(const char *, struct event_queue *);
-time_t notifid_map_get_expiration(const char *);
-int notifid_map_set_expiration(const char *, time_t);
-#endif
-
-/* event store functions */
-int event_store_init(char *);
-int event_store_cleanup();
-int event_store_recover_all(void);
-struct event_store *event_store_find(char *, const char *);
-int event_store_sync(struct event_store *, long);
-int event_store_next(struct event_store *, long, int);
-int event_store_commit(struct event_store *, int, int, int);
-int event_store_recover(struct event_store *);
-int event_store_release(struct event_store *);
-/* int event_store_remove(struct event_store *); */
-
-#if defined(IL_WS)
-/* http functions */
-int parse_header(const char *, il_http_message_t *);
-int receive_http(void *, int (*)(void *, char *, const int), il_http_message_t *);
-#endif
-
-/* master main loop */
-int loop();
-
-/* recover thread */
-void *recover_thread(void*);
-
-#endif
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <signal.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-#include <errno.h>
-
-#include "glite/lb/context-int.h"
-#include "glite/lb/timeouts.h"
-#include "logd_proto.h"
-#include "glite/security/glite_gss.h"
-#ifdef LB_PERF
-#include "glite/lb/lb_perftest.h"
-#endif
-
-static const char rcsid[] = "@(#)$Id$";
-static int verbose = 0;
-static int debug = 0;
-static int port = EDG_WLL_LOG_PORT_DEFAULT;
-static char *prefix = EDG_WLL_LOG_PREFIX_DEFAULT;
-static char *cert_file = NULL;
-static char *key_file = NULL;
-static char *CAcert_dir = NULL;
-static int noAuth = 0;
-static int noIPC = 0;
-static int noParse = 0;
-
-#define DEFAULT_SOCKET "/tmp/interlogger.sock"
-char *socket_path = DEFAULT_SOCKET;
-
-extern int confirm_sock;
-extern char confirm_sock_name[256];
-
-static struct option const long_options[] = {
- { "help", no_argument, 0, 'h' },
- { "version", no_argument, 0, 'V' },
- { "verbose", no_argument, 0, 'v' },
- { "debug", no_argument, 0, 'd' },
- { "port", required_argument, 0, 'p' },
- { "file-prefix", required_argument, 0, 'f' },
- { "cert", required_argument, 0, 'c' },
- { "key", required_argument, 0, 'k' },
- { "CAdir", required_argument, 0, 'C' },
- { "socket",required_argument, 0, 's' },
- { "noAuth", no_argument, 0, 'x' },
- { "noIPC", no_argument, 0, 'y' },
- { "noParse", no_argument, 0, 'z' },
- { NULL, 0, NULL, 0}
-};
-
-/*
- *----------------------------------------------------------------------
- *
- * usage - print usage
- *
- *----------------------------------------------------------------------
- */
-
-static void
-usage(char *program_name) {
- fprintf(stdout,"%s\n"
- "- collect events from logging API calls,\n"
- "- save them to files and\n"
- "- send them to inter-logger\n\n"
- "Usage: %s [option]\n"
- "-h, --help display this help and exit\n"
- "-V, --version output version information and exit\n"
- "-d, --debug do not run as daemon\n"
- "-v, --verbose print extensive debug output\n"
- "-p, --port <num> port to listen\n"
- "-f, --file-prefix <prefix> path and prefix for event files\n"
- "-c, --cert <file> location of server certificate\n"
- "-k, --key <file> location of server private key\n"
- "-C, --CAdir <dir> directory containing CA certificates\n"
- "-s, --socket <dir> interlogger's socket to send messages to\n"
- "--noAuth do not check caller's identity\n"
- "--noIPC do not send messages to inter-logger\n"
- "--noParse do not parse messages for correctness\n",
- program_name,program_name);
-}
-
-static sighandler_t mysignal(int num,sighandler_t handler)
-{
- struct sigaction sa,osa;
-
- memset(&sa,0,sizeof(sa));
- sa.sa_handler = handler;
- sa.sa_flags = SA_RESTART;
- return sigaction(num,&sa,&osa) ? SIG_ERR : osa.sa_handler;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * handle_signal -
- * USR1 - increase the verbosity of the program
- * USR2 - decrease the verbosity of the program
- *
- *----------------------------------------------------------------------
- */
-void handle_signal(int num) {
- if (num != SIGCHLD) edg_wll_ll_log(LOG_NOTICE,"Received signal %d\n", num);
- switch (num) {
- case SIGUSR1:
- if (edg_wll_ll_log_level < LOG_DEBUG) edg_wll_ll_log_level++;
- edg_wll_ll_log(LOG_NOTICE,"Logging level is now %d\n", edg_wll_ll_log_level);
- break;
- case SIGUSR2:
- if (edg_wll_ll_log_level > LOG_EMERG) edg_wll_ll_log_level--;
- edg_wll_ll_log(LOG_NOTICE,"Logging level is now %d\n", edg_wll_ll_log_level);
- break;
- case SIGPIPE:
- edg_wll_ll_log(LOG_NOTICE,"Broken pipe, lost communication channel.\n");
- break;
- case SIGCHLD:
- while (wait3(NULL,WNOHANG,NULL) > 0);
- break;
- case SIGINT:
- case SIGTERM:
- case SIGQUIT:
- if (confirm_sock) {
- edg_wll_ll_log(LOG_NOTICE,"Closing confirmation socket.\n");
- close(confirm_sock);
- unlink(confirm_sock_name);
- }
- exit(1);
- break;
- default: break;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * doit - do all the dirty work
- *
- *----------------------------------------------------------------------
- */
-static int
-doit(int socket, edg_wll_GssCred cred_handle, char *file_name_prefix, int noipc, int noparse)
-{
- char *subject;
- int ret,fd,count;
- struct timeval timeout;
- edg_wll_GssConnection con;
- edg_wll_GssStatus gss_stat;
- edg_wll_GssPrincipal client = NULL;
- fd_set fdset;
- struct sockaddr_in peer;
- socklen_t alen = sizeof peer;
-
- ret = count = 0;
- FD_ZERO(&fdset);
-
- /* accept */
- timeout.tv_sec = ACCEPT_TIMEOUT;
- timeout.tv_usec = 0;
- getpeername(socket,(struct sockaddr *) &peer,&alen);
- edg_wll_ll_log(LOG_DEBUG,"Accepting connection (remaining timeout %d.%06d sec)\n",
- (int)timeout.tv_sec, (int) timeout.tv_usec);
- if ((ret = edg_wll_gss_accept(cred_handle,socket,&timeout,&con, &gss_stat)) < 0) {
- edg_wll_ll_log(LOG_DEBUG,"timeout after gss_accept is %d.%06d sec\n",
- (int)timeout.tv_sec, (int) timeout.tv_usec);
- edg_wll_ll_log(LOG_ERR,"%s: edg_wll_gss_accept() failed\n",inet_ntoa(peer.sin_addr));
- return edg_wll_log_proto_server_failure(ret,&gss_stat,"edg_wll_gss_accept() failed\n");
- }
-
- /* authenticate */
- edg_wll_ll_log(LOG_INFO,"Processing authentication:\n");
- ret = edg_wll_gss_get_client_conn(&con, &client, &gss_stat);
- if (ret) {
- char *gss_err;
- edg_wll_gss_get_error(&gss_stat, "Cannot read client identification", &gss_err);
- edg_wll_ll_log(LOG_WARNING, "%s: %s\n", inet_ntoa(peer.sin_addr),gss_err);
- free(gss_err);
- }
-
- if (ret || client->flags & EDG_WLL_GSS_FLAG_ANON) {
- edg_wll_ll_log(LOG_INFO," User not authenticated, setting as \"%s\". \n",EDG_WLL_LOG_USER_DEFAULT);
- subject=strdup(EDG_WLL_LOG_USER_DEFAULT);
- } else {
- edg_wll_ll_log(LOG_INFO," User successfully authenticated as:\n");
- edg_wll_ll_log(LOG_INFO, " %s\n", client->name);
- subject=strdup(client->name);
- }
- if (client)
- edg_wll_gss_free_princ(client);
-
- /* get and process the data */
- timeout.tv_sec = CONNECTION_TIMEOUT;
- timeout.tv_usec = 0;
-
- while (timeout.tv_sec > 0) {
- count++;
- edg_wll_ll_log(LOG_DEBUG,"Waiting for data delivery no. %d (remaining timeout %d.%06d sec)\n",
- count, (int)timeout.tv_sec, (int) timeout.tv_usec);
- FD_SET(con.sock,&fdset);
- fd = select(con.sock+1,&fdset,NULL,NULL,&timeout);
- switch (fd) {
- case 0: /* timeout */
- edg_wll_ll_log(LOG_DEBUG,"Connection timeout expired\n");
- timeout.tv_sec = 0;
- break;
- case -1: /* error */
- switch(errno) {
- case EINTR:
- edg_wll_ll_log(LOG_DEBUG,"XXX: Waking up (remaining timeout %d.%06d sec)\n",
- (int)timeout.tv_sec, (int) timeout.tv_usec);
- continue;
- default:
- SYSTEM_ERROR("select");
- timeout.tv_sec = 0;
- break;
- }
- break;
- default:
- edg_wll_ll_log(LOG_DEBUG,"Waking up (remaining timeout %d.%06d sec)\n",
- (int)timeout.tv_sec, (int) timeout.tv_usec);
- break;
- }
- if (FD_ISSET(con.sock,&fdset)) {
- ret = edg_wll_log_proto_server(&con,&timeout,subject,file_name_prefix,noipc,noparse);
- if (ret != 0) {
- edg_wll_ll_log(LOG_DEBUG,"timeout after edg_wll_log_proto_server is %d.%06d sec\n",
- (int)timeout.tv_sec, (int) timeout.tv_usec);
- if (ret != EDG_WLL_GSS_ERROR_EOF)
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): Error\n");
- else if (count == 1)
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): Error. EOF occured.\n");
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- break;
- } else {
- timeout.tv_sec = CONNECTION_TIMEOUT;
- timeout.tv_usec = 0;
- }
- }
-
- }
-
-doit_end:
- edg_wll_ll_log(LOG_DEBUG, "Closing descriptor '%d'...",con.sock);
- edg_wll_gss_close(&con, NULL);
- if (con.sock == -1)
- edg_wll_ll_log(LOG_DEBUG, "o.k.\n");
- if (subject) free(subject);
- return ret;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Main -
- *
- *----------------------------------------------------------------------
- */
-int main(int argc, char *argv[])
-{
- int ret;
- int childpid;
- int opt;
-
- int listener_fd;
- int client_fd;
- struct sockaddr_in client_addr;
- int client_addr_len;
-
- time_t cert_mtime = 0, key_mtime = 0;
- edg_wll_GssStatus gss_stat;
- edg_wll_GssCred cred = NULL;
-
-
- setlinebuf(stdout);
- setlinebuf(stderr);
-
- /* welcome */
- fprintf(stdout,"\
-This is LocalLogger, part of Workload Management System in EU DataGrid & EGEE.\n");
-
- /* get arguments */
- while ((opt = getopt_long(argc,argv,
- "h" /* help */
- "V" /* version */
- "v" /* verbose */
- "d" /* debug */
- "p:" /* port */
- "f:" /* file prefix */
- "c:" /* certificate */
- "k:" /* key */
- "C:" /* CA dir */
- "s:" /* socket */
- "x" /* noAuth */
- "y" /* noIPC */
- "z", /* noParse */
- long_options, (int *) 0)) != EOF) {
-
- switch (opt) {
- case 'V': fprintf(stdout,"%s:\t%s\n",argv[0],rcsid); exit(0);
- case 'v': verbose = 1; break;
- case 'd': debug = 1; break;
- case 'p': port = atoi(optarg); break;
- case 'f': prefix = optarg; break;
- case 'c': cert_file = optarg; break;
- case 'k': key_file = optarg; break;
- case 'C': CAcert_dir = optarg; break;
- case 's': socket_path = optarg; break;
- case 'x': noAuth = 1; break;
- case 'y': noIPC = 1; break;
- case 'z': noParse = 1; break;
- case 'h':
- default:
- usage(argv[0]); exit(0);
- }
- }
-#ifdef LB_PERF
- edg_wll_ll_log_init(verbose ? LOG_INFO : LOG_ERR);
-#else
- edg_wll_ll_log_init(verbose ? LOG_DEBUG : LOG_INFO);
-#endif
- edg_wll_ll_log(LOG_INFO,"Initializing...\n");
-
- /* check noParse */
- if (noParse) {
- edg_wll_ll_log(LOG_INFO,"Parse messages for correctness... [no]\n");
- } else {
- edg_wll_ll_log(LOG_INFO,"Parse messages for correctness... [yes]\n");
- }
-
- /* check noIPC */
- if (noIPC) {
- edg_wll_ll_log(LOG_INFO,"Send messages also to inter-logger... [no]\n");
- } else {
- edg_wll_ll_log(LOG_INFO,"Send messages also to inter-logger... [yes]\n");
- }
-
- /* check prefix correctness */
- if (strlen(prefix) > FILENAME_MAX - 34) {
- edg_wll_ll_log(LOG_CRIT,"Too long prefix (%s) for file names, would not be able to write to log files. Exiting.\n",prefix);
- exit(1);
- }
- /* TODO: check for write permisions */
- edg_wll_ll_log(LOG_INFO,"Messages will be stored with the filename prefix \"%s\".\n",prefix);
-
- if (CAcert_dir)
- setenv("X509_CERT_DIR", CAcert_dir, 1);
-
- /* initialize signal handling */
- if (mysignal(SIGUSR1, handle_signal) == SIG_ERR) { perror("signal"); exit(1); }
- if (mysignal(SIGUSR2, handle_signal) == SIG_ERR) { perror("signal"); exit(1); }
- if (mysignal(SIGPIPE, handle_signal) == SIG_ERR) { perror("signal"); exit(1); }
- if (mysignal(SIGHUP, SIG_DFL) == SIG_ERR) { perror("signal"); exit(1); }
- if (mysignal(SIGINT, handle_signal) == SIG_ERR) { perror("signal"); exit(1); }
- if (mysignal(SIGQUIT, handle_signal) == SIG_ERR) { perror("signal"); exit(1); }
- if (mysignal(SIGTERM, handle_signal) == SIG_ERR) { perror("signal"); exit(1); }
- if (mysignal(SIGCHLD, handle_signal) == SIG_ERR) { perror("signal"); exit(1); }
-
-#ifdef LB_PERF
- glite_wll_perftest_init(NULL, NULL, NULL, NULL, 0);
-#endif
-
- edg_wll_gss_watch_creds(cert_file,&cert_mtime);
- /* XXX DK: support noAuth */
- ret = edg_wll_gss_acquire_cred_gsi(cert_file, key_file, &cred, &gss_stat);
- if (ret) {
- /* XXX DK: call edg_wll_gss_get_error() */
- edg_wll_ll_log(LOG_CRIT,"Failed to get GSI credentials. Exiting.\n");
- exit(1);
- }
-
- if (cred->name!=NULL) {
- edg_wll_ll_log(LOG_INFO,"Server running with certificate: %s\n",cred->name);
- } else if (noAuth) {
- edg_wll_ll_log(LOG_INFO,"Server running without certificate\n");
- }
-
- /* do listen */
- edg_wll_ll_log(LOG_INFO,"Listening on port %d\n",port);
- listener_fd = do_listen(port);
- if (listener_fd == -1) {
- edg_wll_ll_log(LOG_CRIT,"Failed to listen on port %d\n",port);
- edg_wll_gss_release_cred(&cred, NULL);
- exit(-1);
- } else {
- edg_wll_ll_log(LOG_DEBUG,"Listener's socket descriptor is '%d'\n",listener_fd);
- }
-
- client_addr_len = sizeof(client_addr);
- bzero((char *) &client_addr, client_addr_len);
-
- /* daemonize */
- if (debug) {
- edg_wll_ll_log(LOG_INFO,"Running as daemon... [no]\n");
- } else {
- edg_wll_ll_log(LOG_INFO,"Running as daemon... [yes]\n");
- if (daemon(0,0) < 0) {
- edg_wll_ll_log(LOG_CRIT,"Failed to run as daemon. Exiting.\n");
- SYSTEM_ERROR("daemon");
- exit(1);
- }
- }
-
- /*
- * Main loop
- */
- while (1) {
- int opt;
-
- edg_wll_ll_log(LOG_INFO,"Accepting incomming connections...\n");
- client_fd = accept(listener_fd, (struct sockaddr *) &client_addr,
- &client_addr_len);
- if (client_fd < 0) {
- close(listener_fd);
- edg_wll_ll_log(LOG_CRIT,"Failed to accept incomming connections\n");
- SYSTEM_ERROR("accept");
- edg_wll_gss_release_cred(&cred, NULL);
- exit(-1);
- } else {
- edg_wll_ll_log(LOG_DEBUG,"Incomming connection on socket '%d'\n",client_fd);
- }
-
- opt = 0;
- if (setsockopt(client_fd,IPPROTO_TCP,TCP_CORK,(const void *) &opt,sizeof opt)) {
- edg_wll_ll_log(LOG_WARNING,"Can't reset TCP_CORK\n");
- }
- opt = 1;
- if (setsockopt(client_fd,IPPROTO_TCP,TCP_NODELAY,(const void *) &opt,sizeof opt)) {
- edg_wll_ll_log(LOG_WARNING,"Can't set TCP_NODELAY\n");
- }
-
- switch (edg_wll_gss_watch_creds(cert_file,&cert_mtime)) {
- edg_wll_GssCred newcred;
- case 0: break;
- case 1:
- ret = edg_wll_gss_acquire_cred_gsi(cert_file,key_file,&newcred,&gss_stat);
- if (ret) {
- edg_wll_ll_log(LOG_WARNING,"Reloading credentials failed, continue with older\n");
- } else {
- edg_wll_ll_log(LOG_DEBUG,"Reloading credentials succeeded\n");
- edg_wll_gss_release_cred(&cred, NULL);
- cred = newcred;
- }
- break;
- case -1:
- edg_wll_ll_log(LOG_WARNING,"edg_wll_gss_watch_creds failed\n");
- break;
- }
-
- /* FORK - change next line if fork() is not needed (for debugging for example) */
-#if 1
- if ((childpid = fork()) < 0) {
- SYSTEM_ERROR("fork");
- if (client_fd) close(client_fd);
- }
- if (childpid == 0) {
- ret = doit(client_fd,cred,prefix,noIPC,noParse);
- if (client_fd) close(client_fd);
- edg_wll_ll_log(LOG_DEBUG,"Exiting.\n",
- CONNECTION_TIMEOUT);
- exit(0);
- }
- if (childpid > 0) {
- edg_wll_ll_log(LOG_DEBUG,"Forked a new child with PID %d\n",childpid);
- if (client_fd) close(client_fd);
- }
-#else
- ret = doit(client_fd,cred,prefix,noIPC,noParse);
- if (client_fd) close(client_fd);
-
-#endif
- } /* while */
-
-end:
- if (listener_fd) close(listener_fd);
- edg_wll_gss_release_cred(&cred, NULL);
- exit(ret);
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <signal.h>
-#include <string.h>
-#include <syslog.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <errno.h>
-
-#include "glite/lbu/escape.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/events_parse.h"
-
-#include "logd_proto.h"
-
-static const int one = 1;
-
-extern char* socket_path;
-
-int edg_wll_ll_log_level;
-
-#define tv_sub(a,b) {\
- (a).tv_usec -= (b).tv_usec;\
- (a).tv_sec -= (b).tv_sec;\
- if ((a).tv_usec < 0) {\
- (a).tv_sec--;\
- (a).tv_usec += 1000000;\
- }\
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * send_answer_back -
- *
- *----------------------------------------------------------------------
- */
-static int send_answer_back(edg_wll_GssConnection *con, int answer, struct timeval *timeout) {
- size_t count = 0;
- int err = 0;
- int ans = answer;
- u_int8_t ans_end[4];
- edg_wll_GssStatus gss_stat;
-
- edg_wll_ll_log(LOG_INFO,"Sending answer \"%d\" back to client...",answer);
- ans_end[0] = ans & 0xff; ans >>= 8;
- ans_end[1] = ans & 0xff; ans >>= 8;
- ans_end[2] = ans & 0xff; ans >>= 8;
- ans_end[3] = ans;
- if ((err = edg_wll_gss_write_full(con,ans_end,4,timeout,&count, &gss_stat)) < 0 ) {
- edg_wll_ll_log(LOG_INFO,"error.\n");
- return edg_wll_log_proto_server_failure(err,&gss_stat,"Error sending answer");
- } else {
- edg_wll_ll_log(LOG_INFO,"o.k.\n");
- return 0;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * wait_for_confirmation -
- *
- * Args: timeout - number of seconds to wait, 0 => wait indefinitely
- *
- * Returns: 1 => OK, *code contains error code sent by interlogger
- * 0 => timeout expired before anything interesting happened
- * -1 => some error (see errno for details)
- *
- *----------------------------------------------------------------------
- */
-int confirm_sock;
-char confirm_sock_name[256];
-
-static
-int init_confirmation()
-{
- struct sockaddr_un saddr;
-
- /* create socket */
- if((confirm_sock=socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- SYSTEM_ERROR("socket");
- edg_wll_ll_log(LOG_ERR,"init_confirmation(): error creating socket\n");
- return(-1);
- }
-
- /* set the socket parameters */
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, confirm_sock_name);
-
- /* bind the socket */
- if(bind(confirm_sock, (struct sockaddr *)&saddr, sizeof(saddr.sun_path)) < 0) {
- SYSTEM_ERROR("bind");
- edg_wll_ll_log(LOG_ERR,"init_confirmation(): error binding socket\n");
- close(confirm_sock);
- unlink(confirm_sock_name);
- return(-1);
- }
-
- /* and listen */
- if(listen(confirm_sock, 5) < 0) {
- SYSTEM_ERROR("listen");
- edg_wll_ll_log(LOG_ERR,"init_confirmation(): error listening on socket\n");
- close(confirm_sock);
- unlink(confirm_sock_name);
- return(-1);
- }
-
- return(0);
-}
-
-
-int wait_for_confirmation(struct timeval *timeout, int *code)
-{
- fd_set fds;
- struct timeval to,before,after;
- int ret = 0, tmp = 0;
-
- *code = 0;
-
- FD_ZERO(&fds);
- FD_SET(confirm_sock, &fds);
-
- /* set timeout */
- if (timeout) {
- memcpy(&to,timeout,sizeof to);
- gettimeofday(&before,NULL);
- }
-
- /* wait for confirmation at most timeout seconds */
- if ((tmp=select(confirm_sock+1, &fds, NULL, NULL, timeout?&to:NULL)) < 0) {
- SYSTEM_ERROR("select");
- edg_wll_ll_log(LOG_ERR,"wait_for_confirmation(): error selecting socket\n");
- ret = -1;
- } else {
- if (tmp == 0)
- ret = 0;
- else {
- int nsd = accept(confirm_sock, NULL, NULL);
- ret = 1;
- if(nsd < 0) {
- SYSTEM_ERROR("accept");
- edg_wll_ll_log(LOG_ERR,"wait_for_confirmation(): error accepting a connection on a socket\n");
- ret = -1;
- } else {
- if(recv(nsd, code, sizeof(*code), MSG_NOSIGNAL) < 0) {
- SYSTEM_ERROR("recv");
- edg_wll_ll_log(LOG_ERR,"wait_for_confirmation(): error receiving a message from a socket\n");
- ret = -1;
- }
- close(nsd);
- }
- }
- }
- close(confirm_sock);
- unlink(confirm_sock_name);
- if (timeout) {
- gettimeofday(&after,NULL);
- tv_sub(after,before);
- tv_sub(*timeout,after);
- if (timeout->tv_sec < 0) {
- timeout->tv_sec = 0;
- timeout->tv_usec = 0;
- }
- }
- return ret;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * do_listen - listen on given port
- *
- * Returns: socket handle or -1 if something fails
- *
- * Calls: socket, bind, listen
- *
- * Algorithm:
- *
- *----------------------------------------------------------------------
- */
-int do_listen(int port)
-{
- int ret;
- int sock;
- struct sockaddr_in my_addr;
-
- memset(&my_addr, 0, sizeof(my_addr));
- my_addr.sin_family = AF_INET;
- my_addr.sin_addr.s_addr = INADDR_ANY;
- my_addr.sin_port = htons(port);
-
- sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (sock == -1) {
- SYSTEM_ERROR("socket");
- edg_wll_ll_log(LOG_ERR,"do_listen(): error creating socket\n");
- return -1;
- }
-
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
- ret = bind(sock, (struct sockaddr *)&my_addr, sizeof(my_addr));
- if (ret == -1) {
- SYSTEM_ERROR("bind");
- edg_wll_ll_log(LOG_ERR,"do_listen(): error binding socket\n");
- return -1;
- }
-
- ret = listen(sock, 5);
- if (ret == -1) {
- SYSTEM_ERROR("listen");
- edg_wll_ll_log(LOG_ERR,"do_listen(): error listening on socket\n");
- close(sock);
- return -1;
- }
-
- return sock;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * edg_wll_log_proto_server - handle incoming data
- *
- * Returns: 0 if done properly or errno
- *
- * Calls:
- *
- * Algorithm:
- *
- *----------------------------------------------------------------------
- */
-int edg_wll_log_proto_server(edg_wll_GssConnection *con, struct timeval *timeout, char *name, char *prefix, int noipc, int noparse)
-{
- char *buf,*dglllid,*dguser,*jobId,*name_esc;
- char header[EDG_WLL_LOG_SOCKET_HEADER_LENGTH+1];
- char outfilename[FILENAME_MAX];
- size_t count;
- int count_total,size;
- u_int8_t size_end[4];
- size_t msg_size,dglllid_size,dguser_size;
- int i,answer,answer_sent;
- int msg_sock;
- char *msg,*msg_begin;
- FILE *outfile;
- int filedesc,filelock_status,flags;
- long filepos;
- struct flock filelock;
- int priority;
- long lllid;
- int unique;
- int err;
- edg_wll_Context context;
- edg_wll_Event *event;
- edg_wlc_JobId j;
- edg_wll_GssStatus gss_stat;
-
- errno = i = answer = answer_sent = size = msg_size = dglllid_size = dguser_size = count = count_total = msg_sock = filedesc = filelock_status = /* priority */ unique = err = 0;
- buf = dglllid = dguser = jobId = name_esc = msg = msg_begin = NULL;
- event = NULL;
-
- /* init */
- if (edg_wll_InitContext(&context) != 0) {
- edg_wll_ll_log(LOG_ERR,"edg_wll_InitContex(): error.\n");
- answer = ENOMEM;
- goto edg_wll_log_proto_server_end;
- }
- if (edg_wll_ResetError(context) != 0) {
- edg_wll_ll_log(LOG_ERR,"edg_wll_ResetError(): error.\n");
- answer = ENOMEM;
- goto edg_wll_log_proto_server_end;
- }
-
- /* look for the unique unused long local-logger id (LLLID) */
- lllid = 1000*getpid();
- for (i=0; (i<1000)&&(!unique); i++) {
- lllid += i;
- snprintf(confirm_sock_name, sizeof(confirm_sock_name), "/tmp/dglogd_sock_%ld", lllid);
- if ((filedesc = open(confirm_sock_name,O_CREAT)) == -1) {
- if (errno == EEXIST) {
- edg_wll_ll_log(LOG_WARNING,"Warning: LLLID %ld already in use.\n",lllid);
- } else {
- SYSTEM_ERROR("open");
- }
- } else {
- unique = 1;
- close(filedesc); filedesc = 0;
- unlink(confirm_sock_name);
- }
- }
- if (!unique) {
- edg_wll_ll_log(LOG_ERR,"Cannot determine the unique long local-logger id (LLLID)!\n",lllid);
- return EAGAIN;
- }
- edg_wll_ll_log(LOG_INFO,"Long local-logger id (LLLID): %ld\n",lllid);
-
- /* receive socket header */
- edg_wll_ll_log(LOG_INFO,"Reading socket header...");
- memset(header, 0, EDG_WLL_LOG_SOCKET_HEADER_LENGTH+1);
- if ((err = edg_wll_gss_read_full(con, header, EDG_WLL_LOG_SOCKET_HEADER_LENGTH, timeout, &count, &gss_stat)) < 0) {
- if (err == EDG_WLL_GSS_ERROR_EOF) {
- edg_wll_ll_log(LOG_INFO,"no data available.\n");
- answer = err;
- answer_sent = 1; /* i.e. do not try to send answer back */
- } else {
- edg_wll_ll_log(LOG_INFO,"error.\n");
- answer = edg_wll_log_proto_server_failure(err,&gss_stat,"Error receiving header");
- }
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_INFO,"o.k.\n");
- }
-
- edg_wll_ll_log(LOG_DEBUG,"Checking socket header...");
- header[EDG_WLL_LOG_SOCKET_HEADER_LENGTH] = '\0';
- if (strncmp(header,EDG_WLL_LOG_SOCKET_HEADER,EDG_WLL_LOG_SOCKET_HEADER_LENGTH)) {
- /* not the proper socket header text */
- edg_wll_ll_log(LOG_DEBUG,"error.\n");
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): invalid socket header\n");
- edg_wll_ll_log(LOG_DEBUG,"edg_wll_log_proto_server(): read header '%s' instead of '%s'\n",
- header,EDG_WLL_LOG_SOCKET_HEADER);
- answer = EINVAL;
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
- }
-
-/* XXX: obsolete
- edg_wll_ll_log(LOG_DEBUG,"Reading message priority...");
- count = 0;
- if ((err = edg_wll_gss_read_full(con, &priority, sizeof(priority), timeout, &count, &gss_stat)) < 0) {
- edg_wll_ll_log(LOG_DEBUG,"error.\n");
- answer = edg_wll_log_proto_server_failure(err,&gss_stat,"Error receiving message priority");
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
- }
-*/
-
- edg_wll_ll_log(LOG_DEBUG,"Reading message size...");
- count = 0;
- if ((err = edg_wll_gss_read_full(con, size_end, 4, timeout, &count,&gss_stat)) < 0) {
- edg_wll_ll_log(LOG_DEBUG,"error.\n");
- answer = edg_wll_log_proto_server_failure(err,&gss_stat,"Error receiving message size");
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
- }
- size = size_end[3]; size <<=8;
- size |= size_end[2]; size <<=8;
- size |= size_end[1]; size <<=8;
- size |= size_end[0];
- edg_wll_ll_log(LOG_DEBUG,"Checking message size...");
- if (size <= 0) {
- edg_wll_ll_log(LOG_DEBUG,"error.\n");
- /* probably wrong size in the header or nothing to read */
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): invalid size read from socket header\n");
- edg_wll_ll_log(LOG_DEBUG,"Read size '%d'.\n",size);
- answer = EINVAL;
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
- edg_wll_ll_log(LOG_DEBUG,"- Size read from header: %d bytes.\n",size);
- }
-
- /* format the DG.LLLID string */
- if (asprintf(&dglllid,"DG.LLLID=%ld ",lllid) == -1) {
- SYSTEM_ERROR("asprintf");
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): nomem for DG.LLLID\n");
- answer = ENOMEM;
- goto edg_wll_log_proto_server_end;
- }
- dglllid_size = strlen(dglllid);
-
- /* format the DG.USER string */
- name_esc = glite_lbu_EscapeULM(name);
- if (asprintf(&dguser,"DG.USER=\"%s\" ",name_esc) == -1) {
- SYSTEM_ERROR("asprintf");
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): nomem for DG.USER\n");
- answer = ENOMEM;
- goto edg_wll_log_proto_server_end;
- }
- dguser_size = strlen(dguser);
-
- /* allocate enough memory for all data */
- msg_size = dglllid_size + dguser_size + size + 1;
- if ((msg = malloc(msg_size)) == NULL) {
- SYSTEM_ERROR("malloc");
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): out of memory for allocating message\n");
- answer = ENOMEM;
- goto edg_wll_log_proto_server_end;
- }
- strncpy(msg,dglllid,dglllid_size);
- msg_begin = msg + dglllid_size; // this is the "official" beginning of the message
- strncpy(msg_begin,dguser,dguser_size);
-
- /* receive message */
- edg_wll_ll_log(LOG_INFO,"Reading message from socket...");
- buf = msg_begin + dguser_size;
- count = 0;
- if ((err = edg_wll_gss_read_full(con, buf, size, timeout, &count, &gss_stat)) < 0) {
- edg_wll_ll_log(LOG_INFO,"error.\n");
- answer = edg_wll_log_proto_server_failure(err,&gss_stat,"Error receiving message");
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_INFO,"o.k.\n");
- }
-
- if (buf[count] != '\0') buf[count] = '\0';
-
- /* parse message and get jobId and priority from it */
- if (!noparse && strstr(msg, "DG.TYPE=\"command\"") == NULL) {
- edg_wll_ll_log(LOG_INFO,"Parsing message for correctness...");
- if (edg_wll_ParseEvent(context,msg_begin,&event) != 0) {
- edg_wll_ll_log(LOG_INFO,"error.\n");
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_proto_server(): edg_wll_ParseEvent error\n");
- edg_wll_ll_log(LOG_ERR,"edg_wll_ParseEvent(): %s\n",context->errDesc);
- answer = edg_wll_Error(context,NULL,NULL);
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_INFO,"o.k.\n");
- }
- edg_wll_ll_log(LOG_DEBUG,"Getting jobId from message...");
- jobId = edg_wlc_JobIdGetUnique(event->any.jobId);
- priority = event->any.priority;
- edg_wll_FreeEvent(event);
- event->any.priority = priority;
- edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
- } else {
- if ((event = edg_wll_InitEvent(EDG_WLL_EVENT_UNDEF)) == NULL) {
- edg_wll_ll_log(LOG_ERR, "edg_wll_InitEvent(): out of memory\n");
- answer = ENOMEM;
- goto edg_wll_log_proto_server_end;
- }
- edg_wll_ll_log(LOG_DEBUG,"Getting jobId from message...");
- jobId = edg_wll_GetJobId(msg);
- if (!jobId || edg_wlc_JobIdParse(jobId,&j)) {
- edg_wll_ll_log(LOG_DEBUG,"error.\n");
- edg_wll_ll_log(LOG_ERR,"ParseJobId(%s)\n",jobId?jobId:"NULL");
- answer = EINVAL;
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
- }
- free(jobId);
- jobId = edg_wlc_JobIdGetUnique(j);
- edg_wlc_JobIdFree(j);
-
-/* TODO: get the priority from message some better way */
- if (strstr(msg, "DG.PRIORITY=1") != NULL)
- event->any.priority = 1;
- else event->any.priority = 0;
- }
-
-
- /* if not command, save message to file */
- if(strstr(msg, "DG.TYPE=\"command\"") == NULL) {
- /* compose the name of the log file */
-// edg_wll_ll_log(LOG_DEBUG,"Composing filename from prefix \"%s\" and unique jobId \"%s\"...",prefix,jobId);
- count = strlen(prefix);
- strncpy(outfilename,prefix,count); count_total=count;
- strncpy(outfilename+count_total,".",1); count_total+=1; count=strlen(jobId);
- strncpy(outfilename+count_total,jobId,count); count_total+=count;
- outfilename[count_total]='\0';
-// edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
-
- /* fopen and properly handle the filelock */
-#ifdef LOGD_NOFILE
- edg_wll_ll_log(LOG_NOTICE,"NOT writing message to \"%s\".\n",outfilename);
- filepos = 0;
-#else
- edg_wll_ll_log(LOG_INFO,"Writing message to \"%s\"...",outfilename);
- if ( edg_wll_log_event_write(context, outfilename, msg, FCNTL_ATTEMPTS, FCNTL_TIMEOUT, &filepos) ) {
- char *errd;
- SYSTEM_ERROR("edg_wll_log_event_write");
- answer = edg_wll_Error(context, NULL, &errd);
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_event_write error: %s\n",errd);
- free(errd);
- goto edg_wll_log_proto_server_end;
- } else edg_wll_ll_log(LOG_INFO,"o.k.\n");
-#endif
- } else {
- filepos = 0;
- }
-
-#ifdef LB_PERF
- edg_wll_ll_log(LOG_INFO,"Calling perftest\n");
- glite_wll_perftest_consumeEventString(msg);
- edg_wll_ll_log(LOG_INFO,"o.k.\n");
-#endif
-
- /* if not priority send now the answer back to client */
- if (!(event->any.priority & (EDG_WLL_LOGFLAG_SYNC|EDG_WLL_LOGFLAG_SYNC_COMPAT))) {
- if (!send_answer_back(con,answer,timeout)) {
- answer_sent = 1;
- }
- }
-
- /* send message via IPC (UNIX socket) */
- if (!noipc) {
- if (event->any.priority & (EDG_WLL_LOGFLAG_SYNC|EDG_WLL_LOGFLAG_SYNC_COMPAT)) {
- edg_wll_ll_log(LOG_DEBUG,"Initializing 2nd UNIX socket (%s) for priority messages confirmation...",confirm_sock_name);
- if(init_confirmation() < 0) {
- edg_wll_ll_log(LOG_DEBUG,"error.\n");
- answer = errno;
- goto edg_wll_log_proto_server_end;
- } else {
- edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
- }
- }
-
- edg_wll_ll_log(LOG_DEBUG,
- "Sending via IPC (UNIX socket \"%s\")\n\t"
- "the message position %ld (%d bytes)",
- socket_path, filepos, sizeof(filepos));
- if ( edg_wll_log_event_send(context, socket_path, filepos, msg, msg_size, CONNECT_ATTEMPTS, timeout) ) {
- char *errd;
- SYSTEM_ERROR("edg_wll_log_event_send");
- answer = edg_wll_Error(context, NULL, &errd);
- edg_wll_ll_log(LOG_ERR,"edg_wll_log_event_send error: %s\n",errd);
- free(errd);
- goto edg_wll_log_proto_server_end_1;
- } else edg_wll_ll_log(LOG_DEBUG,"o.k.\n");
-
- if (event->any.priority & (EDG_WLL_LOGFLAG_SYNC|EDG_WLL_LOGFLAG_SYNC_COMPAT)) {
- edg_wll_ll_log(LOG_INFO,"Waiting for confirmation...");
- if ((count = wait_for_confirmation(timeout, &answer)) < 0) {
- edg_wll_ll_log(LOG_INFO,"error.\n");
- edg_wll_ll_log(LOG_ERR,"wait_for_confirmation(): error.\n");
- answer = errno;
- } else {
- edg_wll_ll_log(LOG_INFO,"o.k.\n");
- if (count == 0) {
- edg_wll_ll_log(LOG_DEBUG,"Waking up, timeout expired.\n");
- answer = EAGAIN;
- } else {
- edg_wll_ll_log(LOG_DEBUG,"Confirmation received, waking up.\n");
- }
- }
- }
- } else {
- edg_wll_ll_log(LOG_DEBUG,"NOT sending via IPC.\n");
- }
-
-edg_wll_log_proto_server_end:
- /* if not sent already, send the answer back to client */
- if (!answer_sent) {
- answer = send_answer_back(con,answer,timeout);
- }
- /* clean */
- edg_wll_FreeContext(context);
- if (name_esc) free(name_esc);
- if (dglllid) free(dglllid);
- if (dguser) free(dguser);
- if (jobId) free(jobId);
- if (msg) free(msg);
- if (event) free(event);
-
-// edg_wll_ll_log(LOG_INFO,"Done.\n");
-
- return answer;
-
-edg_wll_log_proto_server_end_1:
- if (event->any.priority) {
- close(confirm_sock);
- unlink(confirm_sock_name);
- }
- goto edg_wll_log_proto_server_end;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * edg_wll_log_proto_server_failure - handle protocol failures on the server side
- *
- * Returns: errno
- *
- *----------------------------------------------------------------------
- */
-int edg_wll_log_proto_server_failure(int code, edg_wll_GssStatus *gss_code, const char *text)
-{
- const char *func = "edg_wll_log_proto_server()";
- int ret = 0;
-
- if(code>0) {
- return(0);
- }
- switch(code) {
- case EDG_WLL_GSS_ERROR_EOF:
- edg_wll_ll_log(LOG_ERR,"%s: %s, EOF occured\n", func, text);
- ret = EAGAIN;
- break;
- case EDG_WLL_GSS_ERROR_TIMEOUT:
- edg_wll_ll_log(LOG_ERR,"%s: %s, timeout expired\n", func, text);
- ret = EAGAIN;
- break;
- case EDG_WLL_GSS_ERROR_ERRNO:
- SYSTEM_ERROR(func);
- edg_wll_ll_log(LOG_ERR,"%s: %s, system error occured\n", func, text);
- ret = EAGAIN;
- break;
- case EDG_WLL_GSS_ERROR_GSS:
- {
- char *gss_err;
-
- edg_wll_gss_get_error(gss_code, "GSS error occured", &gss_err);
- edg_wll_ll_log(LOG_ERR,"%s: %s, %s\n", func, text, gss_err);
- free(gss_err);
- ret = EAGAIN;
- break;
- }
- default:
- edg_wll_ll_log(LOG_ERR,"%s: %s, unknown error occured\n");
- break;
- }
- return ret;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * edg_wll_ll_log_init - initialize the logging level
- *
- *----------------------------------------------------------------------
- */
-void edg_wll_ll_log_init(int level) {
- edg_wll_ll_log_level = level;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * edg_wll_ll_log - print to stderr according to logging level
- * serious messages are also written to syslog
- *
- *----------------------------------------------------------------------
- */
-void edg_wll_ll_log(int level, const char *fmt, ...) {
- char *err_text;
- va_list fmt_args;
-
- va_start(fmt_args, fmt);
- vasprintf(&err_text, fmt, fmt_args);
- va_end(fmt_args);
-
- if(level <= edg_wll_ll_log_level)
- fprintf(stderr, "[%d] %s", (int) getpid(), err_text);
- if(level <= LOG_ERR) {
- openlog(NULL, LOG_PID | LOG_CONS, LOG_DAEMON);
- syslog(level, "%s", err_text);
- closelog();
- }
-
- if (err_text) free(err_text);
-}
+++ /dev/null
-#ifndef __EDG_WORKLOAD_LOGGING_LOCALLOGGER_LOGD_PROTO_H__
-#define __EDG_WORKLOAD_LOGGING_LOCALLOGGER_LOGD_PROTO_H__
-
-#ident "$Header$"
-
-/**
- * \file edg/workload/logging/locallogger/logd_proto.h
- * \brief server part of the logging protocol
- * \note private
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#include <syslog.h>
-
-#include "glite/lb/log_proto.h"
-#include "glite/security/glite_gss.h"
-
-int edg_wll_log_proto_server(edg_wll_GssConnection *con, struct timeval *timeout, char *name, char *prefix, int noipc, int noparse);
-int edg_wll_log_proto_server_failure(int code, edg_wll_GssStatus *gss_code, const char *text);
-
-#define SYSTEM_ERROR(my_err) { \
- if (errno !=0 ) \
- edg_wll_ll_log(LOG_ERR,"%s: %s\n",my_err,strerror(errno)); \
- else \
- edg_wll_ll_log(LOG_ERR,"%s\n",my_err); }
-
-/* locallogger daemon error handling */
-extern int edg_wll_ll_log_level;
-void edg_wll_ll_log_init(int level);
-void edg_wll_ll_log(int level, const char *fmt, ...);
-
-
-/* fcntl defaults */
-#define FCNTL_ATTEMPTS 5
-#define FCNTL_TIMEOUT 1
-
-/* connect defaults */
-#define CONNECT_ATTEMPTS 5
-
-/* accept defaults */
-#define ACCEPT_TIMEOUT 30
-
-/* connection defaults */
-#define CONNECTION_TIMEOUT EDG_WLL_LOG_SYNC_TIMEOUT_MAX
-
-/* locallogger daemon listen and connect functions prototypes */
-int do_listen(int port);
-int do_connect(char *hostname, int port);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __EDG_WORKLOAD_LOGGING_LOCALLOGGER_LOGD_PROTO_H__ */
+++ /dev/null
-#!/bin/bash
-
-numjobs=10
-
-# XXX - there must be better way to find stage
-if [ -z "${GLITE_LOCATION}" ]; then
- STAGEDIR=/home/michal/shared/egee/jra1-head/stage
-else
- STAGEDIR=${GLITE_LOCATION}
-fi
-
-. $STAGEDIR/sbin/perftest_common.sh
-
-DEBUG=${DEBUG:-0}
-# CONSUMER_ARGS=
-# PERFTEST_COMPONENT=
-# COMPONENT_ARGS=
-LOGJOBS_ARGS="-s /tmp/interlogger.perftest"
-
-check_test_files || exit 1
-
-COMM_ARGS="-s /tmp/interlogger.perftest --file-prefix=/tmp/perftest.log"
-
-#TEST_GROUP=
-#TEST_VARIANT=
-
-SILENT=0
-while getopts "G:t:n:s" OPTION
-do
- case "$OPTION" in
- "G") TEST_GROUP=$OPTARG
- ;;
-
- "t") TEST_VARIANT=$OPTARG
- ;;
-
- "n") numjobs=$OPTARG
- ;;
-
- "s") SILENT=1
- ;;
-
- esac
-done
-
-
-group_a ()
-{
-if [[ $SILENT -eq 0 ]]
-then
-echo "-------------------------------------------"
-echo "Logging test:"
-echo " - events sent through IPC and/or files"
-echo " - events discarded by IL immediately"
-echo "-------------------------------------------"
-echo "a) events sent only by IPC"
-echo "b) events stored to files and sent by IPC"
-echo ""
-fi
-
-PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-interlogd-perf-empty
-CONSUMER_ARGS="-d $COMM_ARGS"
-}
-
-group_a_test_a ()
-{
- LOGJOBS_ARGS="--nofile $COMM_ARGS"
- echo -n "a)"
- run_test il $numjobs
- print_result
-}
-
-group_a_test_b () {
- LOGJOBS_ARGS=" $COMM_ARGS"
- echo -n "b)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-
-
-# echo "--------------------------------"
-# echo "Interlogger test:"
-# echo " - events sent through IPC only"
-# echo " - events discarded in IL"
-# echo "--------------------------------"
-# echo "a) disabled event parsing, the server address (jobid) is hardcoded"
-# echo "b) disabled event synchronization from files"
-# echo "c) disabled recovery thread"
-# echo "d) lazy bkserver connection close"
-# echo "e) normal operation"
-# echo ""
-# echo -e "\tavg_job \t big_job \t avg_dag \t big_dag"
-
-# PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-interlogd-perf
-# LOGJOBS_ARGS="--nofile $COMM_ARGS"
-
-# CONSUMER_ARGS="-d --nosend --noparse $COMM_ARGS"
-# echo -n "a)"
-# run_test il $numjobs
-# print_result
-
-# CONSUMER_ARGS="-d --nosend --nosync $COMM_ARGS"
-# echo -n "b)"
-# run_test il $numjobs
-# print_result
-
-# CONSUMER_ARGS="-d --nosend --norecover $COMM_ARGS"
-# echo -n "c)"
-# run_test il $numjobs
-# print_result
-
-# echo "d) this test is not yet implemented"
-
-# CONSUMER_ARGS="-d --nosend $COMM_ARGS"
-# echo -n "e)"
-# run_test il $numjobs
-# print_result
-
-
-group_b () {
-if [[ $SILENT -eq 0 ]]
-then
-echo "-----------------------------------"
-echo "Interlogger test:"
-echo " - events sent through IPC & files"
-echo " - events discarded in IL"
-echo "-----------------------------------"
-echo "a) disabled event parsing, the server address (jobid) is hardcoded"
-echo "b) disabled event synchronization from files"
-echo "c) disabled recovery thread"
-echo "x) disabled sync and recovery"
-echo "d) lazy bkserver connection close"
-echo "e) normal operation"
-echo ""
-fi
-PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-interlogd-perf
-LOGJOBS_ARGS=" $COMM_ARGS"
-}
-
-group_b_test_a ()
-{
- CONSUMER_ARGS="-d --nosend --noparse $COMM_ARGS"
- echo -n "a)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_b_test_b ()
-{
- CONSUMER_ARGS="-d --nosend --nosync $COMM_ARGS"
- echo -n "b)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_b_test_c ()
-{
- CONSUMER_ARGS="-d --nosend --norecover $COMM_ARGS"
- echo -n "c)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_b_test_x ()
-{
- CONSUMER_ARGS="-d --nosend --nosync --norecover $COMM_ARGS"
- echo -n "x)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_b_test_d ()
-{
- echo "d) this test is not applicable"
-}
-
-group_b_test_e ()
-{
- CONSUMER_ARGS="-d --nosend $COMM_ARGS"
- echo -n "e)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-# echo "-------------------------------"
-# echo "Interlogger test:"
-# echo " - events sent through IPC"
-# echo " - events consumed by empty BS"
-# echo "-------------------------------"
-# echo "a) disabled event parsing, the server address (jobid) is hardcoded"
-# echo "b) disabled event synchronization from files"
-# echo "c) disabled recovery thread"
-# echo "d) lazy bkserver connection close"
-# echo "e) normal operation"
-# echo ""
-# echo -e "\tavg_job \t big_job \t avg_dag \t big_dag"
-
-# PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-bkserverd
-# CONSUMER_ARGS="-d --perf-sink=1"
-# PERFTEST_COMPONENT=$STAGEDIR/bin/glite-lb-interlogd-perf
-# LOGJOBS_ARGS="--nofile $COMM_ARGS"
-
-
-# COMPONENT_ARGS="-d --noparse $COMM_ARGS"
-# echo -n "a)"
-# run_test il $numjobs
-# print_result
-# rm -f /tmp/perftest.log.*
-
-# COMPONENT_ARGS="-d --nosync $COMM_ARGS"
-# echo -n "b)"
-# run_test il $numjobs
-# print_result
-# rm -f /tmp/perftest.log.*
-
-# COMPONENT_ARGS="-d --norecover $COMM_ARGS"
-# echo -n "c)"
-# run_test il $numjobs
-# print_result
-# rm -f /tmp/perftest.log.*
-
-# echo "d) this test is not yet implemented"
-
-# COMPONENT_ARGS="-d $COMM_ARGS"
-# echo -n "e)"
-# run_test il $numjobs
-# print_result
-# rm -f /tmp/perftest.log.*
-
-
-group_c ()
-{
-if [[ $SILENT -eq 0 ]]
-then
-echo "-----------------------------------"
-echo "Interlogger test:"
-echo " - events sent through IPC & files"
-echo " - events consumed by empty BS"
-echo "-----------------------------------"
-echo "a) disabled event parsing, the server address (jobid) is hardcoded"
-echo "b) disabled event synchronization from files"
-echo "c) disabled recovery thread"
-echo "x) disabled sync and recovery"
-echo "d) lazy bkserver connection close"
-echo "e) normal operation"
-echo ""
-fi
-
-PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-bkserverd
-CONSUMER_ARGS="-d --perf-sink=1 -p 10500 -w 10503"
-PERFTEST_COMPONENT=$STAGEDIR/bin/glite-lb-interlogd-perf
-LOGJOBS_ARGS=" -m localhost:10500 $COMM_ARGS"
-}
-
-group_c_test_a ()
-{
- COMPONENT_ARGS="-d --noparse $COMM_ARGS"
- echo -n "a)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_c_test_b ()
-{
- COMPONENT_ARGS="-d --nosync $COMM_ARGS"
- echo -n "b)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_c_test_c ()
-{
- COMPONENT_ARGS="-d --norecover $COMM_ARGS"
- echo -n "c)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_c_test_x ()
-{
- COMPONENT_ARGS="-d --nosync --norecover $COMM_ARGS"
- echo -n "x)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_c_test_d ()
-{
- COMPONENT_ARGS="-d --lazy=10 --nosync --norecover $COMM_ARGS"
- echo -n "d)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-group_c_test_e ()
-{
- COMPONENT_ARGS="-d $COMM_ARGS"
- echo -n "e)"
- run_test il $numjobs
- print_result
- rm -f /tmp/perftest.log.*
-}
-
-
-if [[ $SILENT -eq 0 ]]
-then
- while [[ -z $TEST_GROUP ]]
- do
- echo "Choose test group:"
- echo " a) logging source tests"
- echo " b) interlogger tests"
- echo " c) interlogger with external consumer tests"
- echo -n "Your choice: "
- read TEST_GROUP
- done
-fi
-TEST_GROUP=`echo $TEST_GROUP | tr '[A-Z]' '[a-z]'`
-
-if [[ "x$TEST_GROUP" = "x*" ]]
-then
- TEST_GROUP="a b c"
-fi
-
-for group in $TEST_GROUP
-do
- group_$group
-
- if [[ $SILENT -eq 0 ]]
- then
- while [[ -z $TEST_VARIANT ]]
- do
- echo -n "Your choice: "
- read -e TEST_VARIANT
- done
- echo -e "\tavg_job \t big_job \t avg_dag \t big_dag"
- fi
-
- if [[ "x$TEST_VARIANT" = "x*" ]]
- then
- case $TEST_GROUP in
- "a") TEST_VARIANT="a b" ;;
- *) TEST_VARIANT="a b c x d e" ;;
- esac
- fi
-
- for variant in $TEST_VARIANT
- do
- group_${group}_test_${variant}
- done
-done
-
-exit;
-
+++ /dev/null
-#!/bin/bash
-
-numjobs=1
-
-# XXX - there must be better way to find stage
-if [ -z "${GLITE_LOCATION}" ]; then
- STAGEDIR=/home/michal/shared/egee/jra1-head/stage
-else
- STAGEDIR=${GLITE_LOCATION}
-fi
-
-. $STAGEDIR/sbin/perftest_common.sh
-
-SILENT=0
-while getopts "t:n:s" OPTION
-do
- case "$OPTION" in
- "t") TEST_VARIANT=$OPTARG
- ;;
-
- "n") numjobs=$OPTARG
- ;;
-
- "s") SILENT=1
- ;;
-
- esac
-done
-
-DEBUG=${DEBUG:-0}
-# CONSUMER_ARGS=
-# PERFTEST_COMPONENT=
-# COMPONENT_ARGS=
-# LOGJOBS_ARGS=""
-COMM_ARGS="--file-prefix /tmp/perftest.log -p 45678"
-export EDG_WL_LOG_DESTINATION="localhost:45678"
-
-check_test_files || exit 1
-
-group_a () {
-echo "----------------
-Locallogger test
-----------------
-a) glite-lb-logd-perf-nofile --noParse --noIPC
-b) glite-lb-logd-perf-nofile --noIPC
-c) glite-lb-logd-perf --noIPC
-d) glite-lb-logd-perf
-
-Number of jobs: $numjobs
-"
-}
-
-
-# a)
-group_a_test_a ()
-{
-echo -n "a)"
-PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-logd-perf-nofile
-CONSUMER_ARGS="-d --noIPC --noParse $COMM_ARGS"
-init_result
-run_test ll $numjobs
-#print_result_ev
-print_result
-}
-
-# b)
-group_a_test_b ()
-{
-echo -n "b)"
-PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-logd-perf-nofile
-CONSUMER_ARGS="-d --noIPC $COMM_ARGS"
-init_result
-run_test ll $numjobs
-#print_result_ev
-print_result
-}
-
-# c)
-group_a_test_c ()
-{
-echo -n "c)"
-PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-logd-perf
-CONSUMER_ARGS="-d --noIPC $COMM_ARGS"
-init_result
-run_test ll $numjobs
-#print_result_ev
-print_result
-rm -f /tmp/perftest.log.*
-}
-
-# d)
-group_a_test_d ()
-{
-echo -n "d)"
-PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-interlogd-perf-empty
-CONSUMER_ARGS="-d -s /tmp/perftest.sock"
-PERFTEST_COMPONENT=$STAGEDIR/bin/glite-lb-logd-perf
-COMPONENT_ARGS="-d -s /tmp/perftest.sock $COMM_ARGS"
-init_result
-run_test ll $numjobs
-#print_result_ev
-print_result
-rm -f /tmp/perftest.log.*
-}
-
-group="a"
-
-group_$group
-
-if [[ $SILENT -eq 0 ]]
-then
- while [[ -z $TEST_VARIANT ]]
- do
- echo -n "Your choice: "
- read -e TEST_VARIANT
- done
- echo -e "\tavg_job \t big_job \t avg_dag \t big_dag"
-fi
-
-if [[ "x$TEST_VARIANT" = "x*" ]]
-then
- TEST_VARIANT="a b c d"
-fi
-
-for variant in $TEST_VARIANT
-do
- group_${group}_test_${variant}
-done
+++ /dev/null
-#ident "$Header$"
-
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include "glite/jobid/cjobid.h"
-#include "glite/lb/context.h"
-
-#include "interlogd.h"
-
-struct queue_list {
- struct event_queue *queue;
- char *dest;
- struct queue_list *next;
-#if defined(IL_NOTIFICATIONS)
- time_t expires;
-#endif
-};
-
-static struct event_queue *log_queue;
-static struct queue_list *queues;
-
-
-static
-int
-queue_list_create()
-{
- queues = NULL;
-
- return(0);
-}
-
-
-static
-int
-queue_list_find(struct queue_list *ql, const char *dest, struct queue_list **el, struct queue_list **prev)
-{
- struct queue_list *q, *p;
-
- assert(el != NULL);
-
- *el = NULL;
- if(prev)
- *prev = NULL;
-
- if(ql == NULL)
- return(0);
-
- q = NULL;
- p = ql;
-
- while(p) {
- if(strcmp(p->dest, dest) == 0) {
- *el = p;
- if(prev)
- *prev = q;
- return(1);
- }
-
- q = p;
- p = p->next;
- };
-
- return(0);
-}
-
-
-static
-int
-queue_list_add(struct queue_list **ql, const char *dest, struct event_queue *eq)
-{
- struct queue_list *el;
-
- assert(dest != NULL);
- assert(eq != NULL);
- assert(ql != NULL);
-
- el = malloc(sizeof(*el));
- if(el == NULL) {
- set_error(IL_NOMEM, ENOMEM, "queue_list_add: not enough room for new queue");
- return(-1);
- }
-
- el->dest = strdup(dest);
- if(el->dest == NULL) {
- free(el);
- set_error(IL_NOMEM, ENOMEM, "queue_list_add: not enough memory for new queue");
- return(-1);
- }
- el->queue = eq;
- el->next = *ql;
- *ql = el;
- return 0;
-}
-
-
-#if !defined(IL_NOTIFICATIONS)
-static
-char *
-jobid2dest(edg_wlc_JobId jobid)
-{
- char *server_name,*out;
- unsigned int server_port;
-
- if (!jobid) {
- set_error(IL_PROTO, EDG_WLL_ERROR_PARSE_BROKEN_ULM, "jobid2dest: invalid job id");
- return(NULL);
- }
- edg_wlc_JobIdGetServerParts(jobid,&server_name,&server_port);
-
- asprintf(&out,"%s:%d",server_name,server_port);
- free(server_name);
- if(!out)
- set_error(IL_SYS, ENOMEM, "jobid2dest: error creating server name");
- return(out);
-}
-#endif
-
-struct event_queue *
-queue_list_get(char *job_id_s)
-{
- char *dest;
- struct queue_list *q;
- struct event_queue *eq;
-#if !defined(IL_NOTIFICATIONS)
- IL_EVENT_ID_T job_id;
-
- if(job_id_s == NULL || strcmp(job_id_s, "default") == 0)
- return(log_queue);
-
- if(edg_wlc_JobIdParse(job_id_s, &job_id)) {
- set_error(IL_LBAPI, EDG_WLL_ERROR_PARSE_BROKEN_ULM, "queue_list_get: invalid job id");
- return(NULL);
- }
-
- dest = jobid2dest(job_id);
- edg_wlc_JobIdFree(job_id);
-#else
- dest = job_id_s;
-#endif
-
- if(dest == NULL)
- return(NULL);
-
- if(queue_list_find(queues, dest, &q, NULL)) {
-#if !defined(IL_NOTIFICATIONS)
- free(dest);
-#endif
- return(q->queue);
- } else {
- eq = event_queue_create(dest);
- if(eq)
- queue_list_add(&queues, dest, eq);
-#if !defined(IL_NOTIFICATIONS)
- free(dest);
-#endif
- return(eq);
- }
-}
-
-
-int
-queue_list_is_log(struct event_queue *eq)
-{
- return(eq == queue_list_get(NULL));
-}
-
-
-int
-queue_list_init(char *ls)
-{
-#if !defined(IL_NOTIFICATIONS)
- /* create queue for log server */
- log_queue = event_queue_create(ls);
- if(log_queue == NULL)
- return(-1);
-#endif
-
- return(queue_list_create());
-}
-
-
-static struct queue_list *current;
-
-
-struct event_queue *
-queue_list_first()
-{
- current = queues;
- return(current ? current->queue : NULL);
-}
-
-
-struct event_queue *
-queue_list_next()
-{
- current = current ? current->next : NULL;
- return(current ? current->queue : NULL);
-}
-
-
-int
-queue_list_remove_queue(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- free(eq);
- return(1);
-}
-
-
-#if defined(IL_NOTIFICATIONS)
-
-static struct queue_list *notifid_map = NULL;
-
-struct event_queue *
-notifid_map_get_dest(const char * notif_id)
-{
- struct queue_list *q = NULL;
-
- queue_list_find(notifid_map, notif_id, &q, NULL);
- return(q ? q->queue : NULL);
-}
-
-
-/* returns 1 if mapping was changed, 0 if new one had to be created, -1 on error */
-int
-notifid_map_set_dest(const char *notif_id, struct event_queue *eq)
-{
- struct queue_list *q;
-
- if(queue_list_find(notifid_map, notif_id, &q, NULL)) {
- q->queue = eq;
- return(1);
- } else {
- return(queue_list_add(¬ifid_map, notif_id, eq));
- }
-}
-
-
-time_t
-notifid_map_get_expiration(const char * notif_id)
-{
- struct queue_list *q;
-
- queue_list_find(notifid_map, notif_id, &q, NULL);
- return(q ? q->expires : 0);
-}
-
-
-int
-notifid_map_set_expiration(const char *notif_id, time_t exp)
-{
- struct queue_list *q;
-
- if(queue_list_find(notifid_map, notif_id, &q, NULL)) {
- q->expires = exp;
- return(1);
- } else {
- return(0);
- }
-}
-
-#endif
-
-/* Local Variables: */
-/* c-indentation-style: gnu */
-/* End: */
+++ /dev/null
-#ident "$Header$"
-
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include "glite/jobid/cjobid.h"
-#include "glite/lb/context.h"
-
-#include "interlogd.h"
-
-struct queue_list {
- struct event_queue *queue;
- char *dest;
- struct queue_list *next;
- time_t expires;
-};
-
-static struct event_queue *log_queue;
-static struct queue_list *queues;
-
-
-static
-int
-queue_list_create()
-{
- queues = NULL;
-
- return(0);
-}
-
-
-static
-int
-queue_list_find(struct queue_list *ql, const char *dest, struct queue_list **el, struct queue_list **prev)
-{
- struct queue_list *q, *p;
-
- assert(el != NULL);
-
- *el = NULL;
- if(prev)
- *prev = NULL;
-
- if(ql == NULL)
- return(0);
-
- q = NULL;
- p = ql;
-
- while(p) {
- if(strcmp(p->dest, dest) == 0) {
- *el = p;
- if(prev)
- *prev = q;
- return(1);
- }
-
- q = p;
- p = p->next;
- };
-
- return(0);
-}
-
-
-static
-int
-queue_list_add(struct queue_list **ql, const char *dest, struct event_queue *eq)
-{
- struct queue_list *el;
-
- assert(dest != NULL);
- assert(eq != NULL);
- assert(ql != NULL);
-
- el = malloc(sizeof(*el));
- if(el == NULL) {
- set_error(IL_NOMEM, ENOMEM, "queue_list_add: not enough room for new queue");
- return(-1);
- }
-
- el->dest = strdup(dest);
- if(el->dest == NULL) {
- free(el);
- set_error(IL_NOMEM, ENOMEM, "queue_list_add: not enough memory for new queue");
- return(-1);
- }
- el->queue = eq;
- el->next = *ql;
- *ql = el;
- return 0;
-}
-
-
-struct event_queue *
-queue_list_get(char *job_id_s)
-{
- char *dest;
- struct queue_list *q;
- struct event_queue *eq;
- dest = job_id_s;
-
- if(dest == NULL)
- return(NULL);
-
- if(queue_list_find(queues, dest, &q, NULL)) {
- return(q->queue);
- } else {
- eq = event_queue_create(dest);
- if(eq)
- queue_list_add(&queues, dest, eq);
- return(eq);
- }
-}
-
-
-int
-queue_list_is_log(struct event_queue *eq)
-{
- return(eq == queue_list_get(NULL));
-}
-
-
-int
-queue_list_init(char *ls)
-{
- return(queue_list_create());
-}
-
-
-static struct queue_list *current;
-
-
-struct event_queue *
-queue_list_first()
-{
- current = queues;
- return(current ? current->queue : NULL);
-}
-
-
-struct event_queue *
-queue_list_next()
-{
- current = current ? current->next : NULL;
- return(current ? current->queue : NULL);
-}
-
-
-int
-queue_list_remove_queue(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- free(eq);
- return(1);
-}
-
-
-
-/* Local Variables: */
-/* c-indentation-style: gnu */
-/* End: */
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-
-#include "interlogd.h"
-
-static
-void
-queue_thread_cleanup(void *q)
-{
- struct event_queue *eq = (struct event_queue *)q;
-
- il_log(LOG_WARNING, "thread %d exits\n", eq->thread_id);
-
- /* unlock all held locks */
- /* FIXME: check that the thread always exits when holding these locks;
- unlock them at appropriate places if this condition is not met
- event_queue_unlock(eq);
- event_queue_cond_unlock(eq);
- */
-
- /* clear thread id */
- eq->thread_id = 0;
-}
-
-
-static time_t now;
-
-static
-int
-cmp_expires(struct server_msg *msg, void *data)
-{
- time_t *t = (time_t*)data;
- return (msg->expires > 0) && (msg->expires < *t);
-}
-
-static
-void *
-queue_thread(void *q)
-{
- struct event_queue *eq = (struct event_queue *)q;
- int ret, exit;
- int retrycnt;
- int close_timeout = 0;
- int exit_timeout = EXIT_TIMEOUT;
-
- if(init_errors(0) < 0) {
- il_log(LOG_ERR, "Error initializing thread specific data, exiting!");
- pthread_exit(NULL);
- }
-
- il_log(LOG_DEBUG, " started new thread for delivery to %s:%d\n", eq->dest_name, eq->dest_port);
-
- pthread_cleanup_push(queue_thread_cleanup, q);
-
- event_queue_cond_lock(eq);
-
- exit = 0;
- retrycnt = 0;
- while(!exit) {
-
- clear_error();
-
- /* if there are no events, wait for them */
- ret = 0;
- while (event_queue_empty(eq)
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
- && (eq->flushing != 1)
-#endif
- ) {
- if(lazy_close && close_timeout) {
- ret = event_queue_wait(eq, close_timeout);
- if(ret == 1) {/* timeout? */
- event_queue_close(eq);
- il_log(LOG_DEBUG, " connection to %s:%d closed\n",
- eq->dest_name, eq->dest_port);
- }
- close_timeout = 0;
- } else {
- ret = event_queue_wait(eq, exit_timeout);
- if(ret == 1) {
- il_log(LOG_INFO, " thread idle for more than %d seconds, exiting\n", exit_timeout);
- event_queue_close(eq);
- event_queue_cond_unlock(eq);
- pthread_exit((void*)0);
- }
- }
- if(ret < 0) {
- /* error waiting */
- il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg());
- event_queue_cond_unlock(eq);
- pthread_exit((void*)-1);
- }
- } /* END while(empty) */
-
-
- /* allow other threads to signal us, ie. insert new events while
- * we are sending or request flush operation
- */
- event_queue_cond_unlock(eq);
-
- /* discard expired events */
- il_log(LOG_DEBUG, " discarding expired events\n");
- now = time(NULL);
- event_queue_move_events(eq, NULL, cmp_expires, &now);
- if(!event_queue_empty(eq)) {
-
- /* deliver pending events */
- il_log(LOG_DEBUG, " attempting delivery to %s:%d\n", eq->dest_name, eq->dest_port);
- /* connect to server */
- if((ret=event_queue_connect(eq)) == 0) {
- /* not connected */
- if(error_get_maj() != IL_OK)
- il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg());
-#if defined(IL_NOTIFICATIONS)
- il_log(LOG_INFO, " could not connect to client %s, waiting for retry\n", eq->dest_name);
-#else
- il_log(LOG_INFO, " could not connect to bookkeeping server %s, waiting for retry\n", eq->dest_name);
-#endif
- retrycnt++;
- } else {
- retrycnt = 0;
- /* connected, send events */
- switch(ret=event_queue_send(eq)) {
-
- case 0:
- /* there was an error and we still have events to send */
- if(error_get_maj() != IL_OK)
- il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg());
- il_log(LOG_DEBUG, " events still waiting\n");
- break;
-
- case 1:
- /* hey, we are done for now */
- il_log(LOG_DEBUG, " all events for %s sent\n", eq->dest_name);
- break;
-
- default:
- /* internal error */
- il_log(LOG_ERR, "queue_thread: %s\n", error_get_msg());
- exit = 1;
- break;
-
- } /* switch */
-
- /* we are done for now anyway, so close the queue */
- if((ret == 1) && lazy_close)
- close_timeout = default_close_timeout;
- else {
- event_queue_close(eq);
- il_log(LOG_DEBUG, " connection to %s:%d closed\n",
- eq->dest_name, eq->dest_port);
- }
- }
- }
-
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
- if(pthread_mutex_lock(&flush_lock) < 0)
- abort();
- event_queue_cond_lock(eq);
-
- /* Check if we are flushing and if we are, report status to master */
- if(eq->flushing == 1) {
- il_log(LOG_DEBUG, " flushing mode detected, reporting status\n");
- /* 0 - events waiting, 1 - events sent, < 0 - some error */
- eq->flush_result = ret;
- eq->flushing = 2;
- if(pthread_cond_signal(&flush_cond) < 0)
- abort();
- }
- if(pthread_mutex_unlock(&flush_lock) < 0)
- abort();
-#else
-#endif
-
- /* if there was some error with server, sleep for a while */
- /* iff !event_queue_empty() */
- /* also allow for one more try immediately after server disconnect,
- which may cure server kicking us out after given number of connections */
-#ifndef LB_PERF
- if((ret == 0) && (retrycnt > 0)) {
- il_log(LOG_WARNING, " sleeping\n");
- event_queue_sleep(eq);
- }
-#endif
-
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
-#else
- event_queue_cond_lock(eq);
-#endif
-
- if(exit) {
- /* we have to clean up before exiting */
- event_queue_cond_unlock(eq);
- }
-
- } /* while */
-
- pthread_cleanup_pop(1);
-
- return(eq);
-}
-
-
-int
-event_queue_create_thread(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- event_queue_lock(eq);
-
- /* if there is a thread already, just return */
- if(eq->thread_id > 0) {
- event_queue_unlock(eq);
- return(0);
- }
-
- /* create the thread itself */
- if(pthread_create(&eq->thread_id, NULL, queue_thread, eq) < 0) {
- eq->thread_id = 0;
- set_error(IL_SYS, errno, "event_queue_create_thread: error creating new thread");
- event_queue_unlock(eq);
- return(-1);
- }
-
- /* the thread is never going to be joined */
- pthread_detach(eq->thread_id);
-
- event_queue_unlock(eq);
-
- return(1);
-}
-
-
-
-int
-event_queue_lock(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(pthread_rwlock_wrlock(&eq->update_lock)) {
- /*** abort instead, this is too serious
- set_error(IL_SYS, errno, "event_queue_lock: error acquiring write lock");
- return(-1);
- */
- abort();
- }
-
- return(0);
-}
-
-
-int
-event_queue_lock_ro(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(pthread_rwlock_rdlock(&eq->update_lock)) {
- /*** abort instead, this is too serious
- set_error(IL_SYS, errno, "event_queue_lock_ro: error acquiring read lock");
- return(-1);
- */
- abort();
- }
-
- return(0);
-}
-
-
-int
-event_queue_unlock(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(pthread_rwlock_unlock(&eq->update_lock)) {
- /*** abort instead, this is too serious
- set_error(IL_SYS, errno, "event_queue_unlock: error releasing lock");
- return(-1);
- */
- abort();
- }
-
- return(0);
-}
-
-
-int
-event_queue_signal(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(pthread_cond_signal(&eq->ready_cond)) {
- /*** abort instead, this is too serious
- set_error(IL_SYS, errno, "event_queue_signal: error signaling queue thread");
- return(-1);
- */
- abort();
- }
- return(0);
-}
-
-
-int
-event_queue_wait(struct event_queue *eq, int timeout)
-{
- assert(eq != NULL);
-
- if(timeout) {
- struct timespec endtime;
- int ret = 0;
-
- endtime.tv_sec = time(NULL) + timeout;
- endtime.tv_nsec = 0;
-
- if((ret=pthread_cond_timedwait(&eq->ready_cond, &eq->cond_lock, &endtime))) {
- if(ret == ETIMEDOUT)
- return(1);
- /*** abort instead, this is too serious
- set_error(IL_SYS, errno, "event_queue_wait: error waiting on condition variable");
- return(-1);
- */
- abort();
- }
- } else {
- if(pthread_cond_wait(&eq->ready_cond, &eq->cond_lock)) {
- /*** abort instead, this is too serious
- set_error(IL_SYS, errno, "event_queue_wait: error waiting on condition variable");
- return(-1);
- */
- abort();
- }
- }
- return(0);
-}
-
-
-int event_queue_sleep(struct event_queue *eq)
-{
-#if defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH)
- struct timespec ts;
- struct timeval tv;
- int ret;
-
- assert(eq != NULL);
-
- gettimeofday(&tv, NULL);
- ts.tv_sec = tv.tv_sec + eq->timeout;
- ts.tv_nsec = 1000 * tv.tv_usec;
- if((ret=pthread_cond_timedwait(&eq->flush_cond, &eq->cond_lock, &ts)) < 0) {
- if(ret != ETIMEDOUT) {
- /*** abort instead, this is too serious
- set_error(IL_SYS, errno, "event_queue_sleep: error waiting on condition");
- return(-1);
- */
- abort();
- }
- }
-#else
- sleep(eq->timeout);
-#endif
- return(0);
-}
-
-
-#if defined(INTERLOGD_HANDLE_CMD)
-int event_queue_wakeup(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(pthread_cond_signal(&eq->ready_cond)) {
- /**
- set_error(IL_SYS, errno, "event_queue_wakeup: error signaling queue thread");
- return(-1);
- */
- abort();
- }
-#if defined(INTERLOGD_FLUSH)
- if(pthread_cond_signal(&eq->flush_cond)) {
- /**
- set_error(IL_SYS, errno, "event_queue_wakeup: error signaling queue thread");
- return(-1);
- */
- abort();
- }
-#endif
- return(0);
-}
-#endif
-
-int event_queue_cond_lock(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(pthread_mutex_lock(&eq->cond_lock)) {
- /**
- set_error(IL_SYS, errno, "event_queue_cond_lock: error locking condition mutex");
- return(-1);
- */
- abort();
- }
-
- return(0);
-}
-
-
-int event_queue_cond_unlock(struct event_queue *eq)
-{
- assert(eq != NULL);
-
- if(pthread_mutex_unlock(&eq->cond_lock)) {
- /**
- set_error(IL_SYS, errno, "event_queue_cond_unlock: error locking condition mutex");
- return(-1);
- */
- abort();
- }
-
- return(0);
-}
-
-/* Local Variables: */
-/* c-indentation-style: linux */
-/* End: */
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <assert.h>
-#include <errno.h>
-
-#include "interlogd.h"
-
-extern char *file_prefix;
-
-extern time_t cert_mtime, key_mtime;
-
-void *
-recover_thread(void *q)
-{
- if(init_errors(0) < 0) {
- il_log(LOG_ERR, "Error initializing thread specific data, exiting!");
- pthread_exit(NULL);
- }
-
- while(1) {
- il_log(LOG_INFO, "Looking up event files...\n");
- if(event_store_init(file_prefix) < 0) {
- il_log(LOG_ERR, "recover_thread: %s\n", error_get_msg());
- exit(1);
- }
- if(event_store_recover_all() < 0) {
- il_log(LOG_ERR, "recover_thread: %s\n", error_get_msg());
- exit(1);
- }
- if(event_store_cleanup() < 0) {
- il_log(LOG_ERR, "recover_thread: %s\n", error_get_msg());
- exit(1);
- }
- il_log(LOG_INFO, "Reloading certificate...\n");
- if (edg_wll_gss_watch_creds(cert_file, &cert_mtime) > 0) {
- edg_wll_GssCred new_creds = NULL;
- int ret;
-
- ret = edg_wll_gss_acquire_cred_gsi(cert_file,key_file,
- &new_creds, NULL);
- if (new_creds != NULL) {
- if(pthread_mutex_lock(&cred_handle_lock) < 0)
- abort();
- /* if no one is using the old credentials, release them */
- if(cred_handle && cred_handle->counter == 0) {
- edg_wll_gss_release_cred(&cred_handle->creds, NULL);
- free(cred_handle);
- il_log(LOG_DEBUG, " freed old credentials\n");
- }
- cred_handle = malloc(sizeof(*cred_handle));
- if(cred_handle == NULL) {
- il_log(LOG_CRIT, "Failed to allocate structure for credentials.\n");
- exit(EXIT_FAILURE);
- }
- cred_handle->creds = new_creds;
- cred_handle->counter = 0;
- if(pthread_mutex_unlock(&cred_handle_lock) < 0)
- abort();
- il_log(LOG_INFO, "New certificate found and deployed.\n");
- }
- }
- sleep(INPUT_TIMEOUT);
- }
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-
-/*
- * - L/B server protocol handling routines
- */
-
-#include "glite/jobid/cjobid.h"
-#include "glite/lb/il_string.h"
-#include "glite/lb/context.h"
-
-#include "interlogd.h"
-
-#if defined(INTERLOGD_EMS) || (defined(INTERLOGD_HANDLE_CMD) && defined(INTERLOGD_FLUSH))
-/*
- * Send confirmation to client.
- *
- */
-int
-send_confirmation(long lllid, int code)
-{
- struct sockaddr_un saddr;
- char sname[256];
- int sock, ret;
-
- if((sock=socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- set_error(IL_SYS, errno, "send_confirmation: error creating socket");
- return(-1);
- }
-
- if(fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
- set_error(IL_SYS, errno, "send_confirmation: error setting socket options");
- return(-1);
- }
-
- ret = 0;
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- snprintf(sname, sizeof(sname), "/tmp/dglogd_sock_%ld", lllid);
- strcpy(saddr.sun_path, sname);
- if(connect(sock, (struct sockaddr *)&saddr, sizeof(saddr.sun_path)) < 0) {
- set_error(IL_SYS, errno, "send_confirmation: error connecting socket");
- goto out;
- }
-
- if(send(sock, &code, sizeof(code), MSG_NOSIGNAL) < 0) {
- set_error(IL_SYS, errno, "send_confirmation: error sending data");
- goto out;
- }
- ret = 1;
-
- il_log(LOG_DEBUG, " sent code %d back to client\n", code);
-
- out:
- close(sock);
- return(ret);
-}
-
-
-static
-int
-confirm_msg(struct server_msg *msg, int code, int code_min)
-{
- switch(code) {
- case LB_OK:
- code_min = 0;
- break;
- case LB_DBERR:
- /* code_min already contains apropriate error code */
- break;
- case LB_PROTO:
- code_min = EDG_WLL_IL_PROTO;
- break;
- default:
- code_min = EDG_WLL_IL_SYS;
- break;
- }
-
- return(send_confirmation(msg->receipt_to, code_min));
-}
-#endif
-
-
-
-struct reader_data {
- edg_wll_GssConnection *gss;
- struct timeval *timeout;
-};
-
-
-static
-int
-gss_reader(void *user_data, char *buffer, int max_len)
-{
- int ret;
- size_t len;
- struct reader_data *data = (struct reader_data *)user_data;
- edg_wll_GssStatus gss_stat;
-
- ret = edg_wll_gss_read_full(data->gss, buffer, max_len, data->timeout, &len, &gss_stat);
- if(ret < 0) {
- char *gss_err = NULL;
-
- if(ret == EDG_WLL_GSS_ERROR_GSS) {
- edg_wll_gss_get_error(&gss_stat, "get_reply", &gss_err);
- set_error(IL_DGGSS, ret, gss_err);
- free(gss_err);
- } else
- set_error(IL_DGGSS, ret, "get_reply");
- }
- return(ret);
-}
-
-
-/*
- * Read reply from server.
- * Returns: -1 - error reading message,
- * code > 0 - error code from server
- */
-static
-int
-get_reply(struct event_queue *eq, char **buf, int *code_min)
-{
- char *msg=NULL;
- int ret, code;
- int len, l;
- struct timeval tv;
- struct reader_data data;
-
- tv.tv_sec = TIMEOUT;
- tv.tv_usec = 0;
- data.gss = &eq->gss;
- data.timeout = &tv;
- len = read_il_data(&data, &msg, gss_reader);
- if(len < 0) {
- set_error(IL_PROTO, LB_PROTO, "get_reply: error reading server reply");
- return(-1);
- }
- ret = decode_il_reply(&code, code_min, buf, msg);
- if(msg) free(msg);
- if(ret < 0) {
- set_error(IL_PROTO, LB_PROTO, "get_reply: error decoding server reply");
- return(-1);
- }
- return(code);
-}
-
-
-
-/*
- * Returns: 0 - not connected, timeout set, 1 - OK
- */
-int
-event_queue_connect(struct event_queue *eq)
-{
- int ret;
- struct timeval tv;
- edg_wll_GssStatus gss_stat;
- cred_handle_t *local_cred_handle;
-
- assert(eq != NULL);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
-
- if(eq->gss.context == NULL) {
-
- tv.tv_sec = TIMEOUT;
- tv.tv_usec = 0;
-
- /* get pointer to the credentials */
- if(pthread_mutex_lock(&cred_handle_lock) < 0)
- abort();
- local_cred_handle = cred_handle;
- local_cred_handle->counter++;
- if(pthread_mutex_unlock(&cred_handle_lock) < 0)
- abort();
-
- il_log(LOG_DEBUG, " trying to connect to %s:%d\n", eq->dest_name, eq->dest_port);
- ret = edg_wll_gss_connect(local_cred_handle->creds, eq->dest_name, eq->dest_port, &tv, &eq->gss, &gss_stat);
- if(pthread_mutex_lock(&cred_handle_lock) < 0)
- abort();
- /* check if we need to release the credentials */
- --local_cred_handle->counter;
- if(local_cred_handle != cred_handle && local_cred_handle->counter == 0) {
- edg_wll_gss_release_cred(&local_cred_handle->creds, NULL);
- free(local_cred_handle);
- il_log(LOG_DEBUG, " freed credentials, not used anymore\n");
- }
- if(pthread_mutex_unlock(&cred_handle_lock) < 0)
- abort();
-
- if(ret < 0) {
- char *gss_err = NULL;
-
- if (ret == EDG_WLL_GSS_ERROR_GSS)
- edg_wll_gss_get_error(&gss_stat, "event_queue_connect: edg_wll_gss_connect", &gss_err);
- set_error(IL_DGGSS, ret,
- (ret == EDG_WLL_GSS_ERROR_GSS) ? gss_err : "event_queue_connect: edg_wll_gss_connect");
- if (gss_err) free(gss_err);
- eq->gss.context = NULL;
- eq->timeout = TIMEOUT;
- return(0);
- }
- }
-
-#ifdef LB_PERF
- }
-#endif
-
- return(1);
-}
-
-
-int
-event_queue_close(struct event_queue *eq)
-{
- assert(eq != NULL);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
-
- if(eq->gss.context != NULL) {
- edg_wll_gss_close(&eq->gss, NULL);
- eq->gss.context = NULL;
- }
-#ifdef LB_PERF
- }
-#endif
- return(0);
-}
-
-
-/*
- * Send all events from the queue.
- * Returns: -1 - system error, 0 - not send, 1 - queue empty
- */
-int
-event_queue_send(struct event_queue *eq)
-{
- int events_sent = 0;
- assert(eq != NULL);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
- if(eq->gss.context == NULL)
- return(0);
-#ifdef LB_PERF
- }
-#endif
-
- /* feed the server with events */
- while (!event_queue_empty(eq)) {
- struct server_msg *msg;
- char *rep;
- int ret, code, code_min;
- size_t bytes_sent;
- struct timeval tv;
- edg_wll_GssStatus gss_stat;
-
- clear_error();
-
- if(event_queue_get(eq, &msg) < 0)
- return(-1);
-
- il_log(LOG_DEBUG, " trying to deliver event at offset %d for job %s\n", msg->offset, msg->job_id_s);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
- if (msg->len) {
- tv.tv_sec = TIMEOUT;
- tv.tv_usec = 0;
- ret = edg_wll_gss_write_full(&eq->gss, msg->msg, msg->len, &tv, &bytes_sent, &gss_stat);
- if(ret < 0) {
- if (ret == EDG_WLL_GSS_ERROR_ERRNO && errno == EPIPE && events_sent > 0)
- eq->timeout = 0;
- else
- eq->timeout = TIMEOUT;
- return(0);
- }
-
- if((code = get_reply(eq, &rep, &code_min)) < 0) {
- /* could not get the reply properly, so try again later */
- if (events_sent>0) {
- /* could be expected server connection preemption */
- clear_error();
- eq->timeout = 1;
- } else {
- eq->timeout = TIMEOUT;
- il_log(LOG_ERR, " error reading server %s reply:\n %s\n", eq->dest_name, error_get_msg());
- }
- return(0);
- }
- }
- else { code = LB_OK; code_min = 0; rep = strdup("not sending empty message"); }
-#ifdef LB_PERF
- } else {
- glite_wll_perftest_consumeEventIlMsg(msg->msg+17);
- code = LB_OK;
- rep = strdup("OK");
- }
-#endif
-
- il_log(LOG_DEBUG, " event sent, server %s replied with %d, %s\n", eq->dest_name, code, rep);
- free(rep);
-
- /* the reply is back here */
- switch(code) {
-
- /* NOT USED: case LB_TIME: */
- case LB_NOMEM:
- /* NOT USED: case LB_SYS: */
- /* NOT USED: case LB_AUTH: */
- /* non fatal errors (for us) */
- eq->timeout = TIMEOUT;
- return(0);
-
- case LB_OK:
- /* event succesfully delivered */
-
- default: /* LB_DBERR, LB_PROTO */
- /* the event was not accepted by the server */
- /* update the event pointer */
- if(event_store_commit(msg->es, msg->ev_len, queue_list_is_log(eq), msg->generation) < 0)
- /* failure committing message, this is bad */
- return(-1);
- /* if we have just delivered priority message from the queue, send confirmation */
- ret = 1;
-#if defined(INTERLOGD_EMS)
- if(server_msg_is_priority(msg) &&
- ((ret=confirm_msg(msg, code, code_min)) < 0))
- return(ret);
-#endif
-
- if((ret == 0) &&
- (error_get_maj() != IL_OK))
- il_log(LOG_ERR, "send_event: %s\n", error_get_msg());
-
- event_queue_remove(eq);
- events_sent++;
- break;
-
- } /* switch */
- } /* while */
-
- return(1);
-
-} /* send_events */
-
-
+++ /dev/null
-#ident "$Header$"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-
-/*
- * - L/B server protocol handling routines
- */
-
-#include "glite/jobid/cjobid.h"
-#include "glite/lb/il_string.h"
-#include "glite/lb/context.h"
-
-#include "interlogd.h"
-
-struct reader_data {
- edg_wll_GssConnection *gss;
- struct timeval *timeout;
-};
-
-
-static
-int
-gss_reader(void *user_data, char *buffer, int max_len)
-{
- int ret;
- struct reader_data *data = (struct reader_data *)user_data;
- edg_wll_GssStatus gss_stat;
-
- ret = edg_wll_gss_read(data->gss, buffer, max_len, data->timeout, &gss_stat);
- if(ret < 0) {
- char *gss_err = NULL;
-
- if(ret == EDG_WLL_GSS_ERROR_GSS) {
- edg_wll_gss_get_error(&gss_stat, "get_reply", &gss_err);
- set_error(IL_DGGSS, ret, gss_err);
- free(gss_err);
- } else
- set_error(IL_DGGSS, ret, "get_reply");
- }
- return(ret);
-}
-
-
-/*
- * Read reply from server.
- * Returns: -1 - error reading message,
- * code > 0 - http status code from server
- */
-static
-int
-get_reply(struct event_queue *eq, char **buf, int *code_min)
-{
- int ret, code;
- int len;
- struct timeval tv;
- struct reader_data data;
- il_http_message_t msg;
-
- tv.tv_sec = TIMEOUT;
- tv.tv_usec = 0;
- data.gss = &eq->gss;
- data.timeout = &tv;
- len = receive_http(&data, gss_reader, &msg);
- if(len < 0) {
- set_error(IL_PROTO, LB_PROTO, "get_reply: error reading server reply");
- return(-1);
- }
- if(msg.data) free(msg.data);
- if(msg.reply_string) *buf = msg.reply_string;
- *code_min = 0; /* XXX fill in flag for fault */
- return(msg.reply_code);
-}
-
-
-
-/*
- * Returns: 0 - not connected, timeout set, 1 - OK
- */
-int
-event_queue_connect(struct event_queue *eq)
-{
- int ret;
- struct timeval tv;
- edg_wll_GssStatus gss_stat;
- cred_handle_t *local_cred_handle;
-
- assert(eq != NULL);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
-
- if(eq->gss.context == NULL) {
-
- tv.tv_sec = TIMEOUT;
- tv.tv_usec = 0;
-
- /* get pointer to the credentials */
- if(pthread_mutex_lock(&cred_handle_lock) < 0)
- abort();
- local_cred_handle = cred_handle;
- local_cred_handle->counter++;
- if(pthread_mutex_unlock(&cred_handle_lock) < 0)
- abort();
-
- il_log(LOG_DEBUG, " trying to connect to %s:%d\n", eq->dest_name, eq->dest_port);
- ret = edg_wll_gss_connect(local_cred_handle->creds, eq->dest_name, eq->dest_port, &tv, &eq->gss, &gss_stat);
- if(pthread_mutex_lock(&cred_handle_lock) < 0)
- abort();
- /* check if we need to release the credentials */
- --local_cred_handle->counter;
- if(local_cred_handle != cred_handle && local_cred_handle->counter == 0) {
- edg_wll_gss_release_cred(&local_cred_handle->creds, NULL);
- free(local_cred_handle);
- il_log(LOG_DEBUG, " freed credentials, not used anymore\n");
- }
- if(pthread_mutex_unlock(&cred_handle_lock) < 0)
- abort();
-
- if(ret < 0) {
- char *gss_err = NULL;
-
- if (ret == EDG_WLL_GSS_ERROR_GSS)
- edg_wll_gss_get_error(&gss_stat, "event_queue_connect: edg_wll_gss_connect", &gss_err);
- set_error(IL_DGGSS, ret,
- (ret == EDG_WLL_GSS_ERROR_GSS) ? gss_err : "event_queue_connect: edg_wll_gss_connect");
- if (gss_err) free(gss_err);
- eq->gss.context = NULL;
- eq->timeout = TIMEOUT;
- return(0);
- }
- }
-
-#ifdef LB_PERF
- }
-#endif
-
- return(1);
-}
-
-
-int
-event_queue_close(struct event_queue *eq)
-{
- assert(eq != NULL);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
-
- if(eq->gss.context != NULL) {
- edg_wll_gss_close(&eq->gss, NULL);
- eq->gss.context = NULL;
- }
-#ifdef LB_PERF
- }
-#endif
- return(0);
-}
-
-
-/*
- * Send all events from the queue.
- * Returns: -1 - system error, 0 - not sent, 1 - queue empty
- */
-int
-event_queue_send(struct event_queue *eq)
-{
- int events_sent = 0;
- assert(eq != NULL);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
- if(eq->gss.context == NULL)
- return(0);
-#ifdef LB_PERF
- }
-#endif
-
- /* feed the server with events */
- while (!event_queue_empty(eq)) {
- struct server_msg *msg;
- char *rep;
- int ret, code, code_min;
- size_t bytes_sent;
- struct timeval tv;
- edg_wll_GssStatus gss_stat;
-
- clear_error();
-
- if(event_queue_get(eq, &msg) < 0)
- return(-1);
-
- il_log(LOG_DEBUG, " trying to deliver event at offset %d for job %s\n", msg->offset, msg->job_id_s);
-
-#ifdef LB_PERF
- if(!nosend) {
-#endif
- /* XXX: ljocha -- does it make sense to send empty messages ? */
- if (msg->len) {
- tv.tv_sec = TIMEOUT;
- tv.tv_usec = 0;
- ret = edg_wll_gss_write_full(&eq->gss, msg->msg, msg->len, &tv, &bytes_sent, &gss_stat);
- if(ret < 0) {
- if (ret == EDG_WLL_GSS_ERROR_ERRNO && errno == EPIPE && events_sent > 0) {
- eq->timeout = 0;
- } else {
- il_log(LOG_ERR, "send_event: %s\n", error_get_msg());
- eq->timeout = TIMEOUT;
- }
- return(0);
- }
- if((code = get_reply(eq, &rep, &code_min)) < 0) {
- /* could not get the reply properly, so try again later */
- if (events_sent>0)
- eq->timeout = 1;
- else {
- eq->timeout = TIMEOUT;
- il_log(LOG_ERR, " error reading server %s reply:\n %s\n", eq->dest_name, error_get_msg());
- }
- return(0);
- }
- }
- else { code = 200; code_min = 0; rep = strdup("not sending empty message"); }
-#ifdef LB_PERF
- } else {
- glite_wll_perftest_consumeEventIlMsg(msg->msg+17);
- code = 200;
- rep = strdup("OK");
- }
-#endif
-
- il_log(LOG_DEBUG, " event sent, server %s replied with %d, %s\n", eq->dest_name, code, rep);
- free(rep);
-
- /* the reply is back here, decide what to do with message */
- /* HTTP error codes:
- 1xx - informational (eg. 100 Continue)
- 2xx - successful (eg. 200 OK)
- 3xx - redirection (eg. 301 Moved Permanently)
- 4xx - client error (eq. 400 Bad Request)
- 5xx - server error (eq. 500 Internal Server Error)
- */
- if(code >= 100 && code < 200) {
-
- /* non fatal errors (for us), try to deliver later */
- eq->timeout = TIMEOUT;
- return(0);
- }
-
- /* the message was consumed (successfully or not) */
- /* update the event pointer */
- if(event_store_commit(msg->es, msg->ev_len, queue_list_is_log(eq)) < 0)
- /* failure committing message, this is bad */
- return(-1);
-
- event_queue_remove(eq);
- events_sent++;
- } /* while */
-
- return(1);
-
-} /* send_events */
-
-
-/* this is just not used */
-int
-send_confirmation(long lllid, int code)
-{
- return 0;
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-
-#include "interlogd.h"
-#include "glite/lb/il_msg.h"
-#include "glite/lb/events_parse.h"
-#include "glite/lb/context.h"
-
-static
-int
-create_msg(il_octet_string_t *ev, char **buffer, long *receipt, time_t *expires)
-{
- char *p; int len;
- char *event = ev->data;
-
- *receipt = 0L;
-
-#if defined(INTERLOGD_EMS)
- /* find DG.LLLID */
- if(strncmp(event, "DG.LLLID",8) == 0 ||
- strncmp(event, "DG.LLPID",8) == 0) { /* 8 == strlen("DG.LLLID") */
-
- /* skip the key */
- event += 9; /* 9 = strlen("DG.LLLID=") */
- *receipt = atol(event);
- p = strchr(event, ' ');
- if(!p) {
- set_error(IL_LBAPI, EDG_WLL_ERROR_PARSE_BROKEN_ULM,
- "create_msg: error parsing locallogger PID");
- return(-1);
- }
- /* skip the value */
- event = p + 1;
-
- /* find DG.PRIORITY */
- p = strstr(event, "DG.PRIORITY");
- if(p) {
- int n;
-
- p += 12; /* skip the key and = */
- n = atoi(p);
- if((n & (EDG_WLL_LOGFLAG_SYNC|EDG_WLL_LOGFLAG_SYNC_COMPAT)) == 0) {
- /* normal asynchronous message */
- *receipt = 0L;
- }
- } else {
- /* could not find priority key */
- *receipt = 0L;
- }
-
- } else {
- /* could not find local logger PID, confirmation can not be sent */
- *receipt = 0L;
- }
-#endif
-
- if(p = strstr(event, "DG.EXPIRES")) {
- int n;
-
- p += 11;
- *expires = atoi(p);
- }
- len = encode_il_msg(buffer, ev);
- if(len < 0) {
- set_error(IL_NOMEM, ENOMEM, "create_msg: out of memory allocating message");
- return(-1);
- }
- return(len);
-}
-
-
-struct server_msg *
-server_msg_create(il_octet_string_t *event, long offset)
-{
- struct server_msg *msg;
-
- msg = malloc(sizeof(*msg));
- if(msg == NULL) {
- set_error(IL_NOMEM, ENOMEM, "server_msg_create: out of memory allocating message");
- return(NULL);
- }
-
- if(server_msg_init(msg, event) < 0) {
- server_msg_free(msg);
- return(NULL);
- }
- msg->offset = offset;
-
- return(msg);
-}
-
-
-struct server_msg *
-server_msg_copy(struct server_msg *src)
-{
- struct server_msg *msg;
-
- msg = malloc(sizeof(*msg));
- if(msg == NULL) {
- set_error(IL_NOMEM, ENOMEM, "server_msg_copy: out of memory allocating message");
- return(NULL);
- }
-
- msg->msg = malloc(src->len);
- if(msg->msg == NULL) {
- set_error(IL_NOMEM, ENOMEM, "server_msg_copy: out of memory allocating server message");
- server_msg_free(msg);
- return(NULL);
- }
- msg->len = src->len;
- memcpy(msg->msg, src->msg, src->len);
-
- msg->job_id_s = strdup(src->job_id_s);
- msg->ev_len = src->ev_len;
- msg->es = src->es;
- msg->receipt_to = src->receipt_to;
- msg->offset = src->offset;
-#if defined(IL_NOTIFICATIONS)
- msg->dest_name = src->dest_name ? strdup(src->dest_name) : NULL;
- msg->dest_port = src->dest_port;
- msg->dest = src->dest ? strdup(src->dest) : NULL;
-#endif
- msg->expires = src->expires;
- msg->generation = src->generation;
- return(msg);
-}
-
-
-int
-server_msg_init(struct server_msg *msg, il_octet_string_t *event)
-{
-#if defined(IL_NOTIFICATIONS)
- edg_wll_Context context;
- edg_wll_Event *notif_event;
- int ret;
-#endif
-
- assert(msg != NULL);
- assert(event != NULL);
-
- memset(msg, 0, sizeof(*msg));
-
-
-#if defined(IL_NOTIFICATIONS)
-
- /* parse the notification event */
- edg_wll_InitContext(&context);
- ret=edg_wll_ParseNotifEvent(context, event->data, ¬if_event);
- edg_wll_FreeContext(context);
- if(ret) {
- set_error(IL_LBAPI, ret, "server_msg_init: error parsing notification event");
- return(-1);
- }
-
- /* FIXME: check for allocation error */
- if(notif_event->notification.dest_host &&
- (strlen(notif_event->notification.dest_host) > 0)) {
- msg->dest_name = strdup(notif_event->notification.dest_host);
- msg->dest_port = notif_event->notification.dest_port;
- asprintf(&msg->dest, "%s:%d", msg->dest_name, msg->dest_port);
- }
- msg->job_id_s = edg_wll_NotifIdUnparse(notif_event->notification.notifId);
- if(notif_event->notification.jobstat &&
- (strlen(notif_event->notification.jobstat) > 0)) {
- msg->len = create_msg(event, &msg->msg, &msg->receipt_to, &msg->expires);
- }
- msg->expires = notif_event->notification.expires;
- edg_wll_FreeEvent(notif_event);
- free(notif_event);
- if(msg->len < 0) {
- return(-1);
- }
-#else
- msg->len = create_msg(event, &msg->msg, &msg->receipt_to, &msg->expires);
- if(msg->len < 0) {
- return(-1);
- }
-#ifdef LB_PERF
- if(noparse) {
- msg->job_id_s = strdup("https://localhost:9000/not_so_unique_string");
- } else
-#endif
- msg->job_id_s = edg_wll_GetJobId(event->data);
-#endif
- /* remember to add event separator to the length */
- msg->ev_len = event->len + 1;
-
- if(msg->job_id_s == NULL) {
- set_error(IL_LBAPI, EDG_WLL_ERROR_PARSE_BROKEN_ULM, "server_msg_init: error getting id");
- return(-1);
- }
-
- return(0);
-}
-
-
-int
-server_msg_is_priority(struct server_msg *msg)
-{
- assert(msg != NULL);
-
- return(msg->receipt_to != 0);
-}
-
-
-int
-server_msg_free(struct server_msg *msg)
-{
- assert(msg != NULL);
-
- if(msg->msg) free(msg->msg);
- if(msg->job_id_s) free(msg->job_id_s);
-#if defined(IL_NOTIFICATIONS)
- if(msg->dest_name) free(msg->dest_name);
- if(msg->dest) free(msg->dest);
-#endif
- free(msg);
- return 0;
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-
-#include "interlogd.h"
-#include "glite/lb/il_msg.h"
-#include "glite/lb/events_parse.h"
-#include "glite/lb/context.h"
-
-static
-int
-create_msg(il_http_message_t *ev, char **buffer, long *receipt, time_t *expires)
-{
- char *event = ev->data;
-
- *receipt = 0;
- *expires = 0;
-
- *buffer = ev->data;
- return ev->len;;
-}
-
-
-struct server_msg *
-server_msg_create(il_octet_string_t *event, long offset)
-{
- struct server_msg *msg;
-
- msg = malloc(sizeof(*msg));
- if(msg == NULL) {
- set_error(IL_NOMEM, ENOMEM, "server_msg_create: out of memory allocating message");
- return(NULL);
- }
-
- if(server_msg_init(msg, event) < 0) {
- server_msg_free(msg);
- return(NULL);
- }
- msg->offset = offset;
-
- return(msg);
-}
-
-
-struct server_msg *
-server_msg_copy(struct server_msg *src)
-{
- struct server_msg *msg;
-
- msg = malloc(sizeof(*msg));
- if(msg == NULL) {
- set_error(IL_NOMEM, ENOMEM, "server_msg_copy: out of memory allocating message");
- return(NULL);
- }
-
- msg->msg = malloc(src->len);
- if(msg->msg == NULL) {
- set_error(IL_NOMEM, ENOMEM, "server_msg_copy: out of memory allocating server message");
- server_msg_free(msg);
- return(NULL);
- }
- msg->len = src->len;
- memcpy(msg->msg, src->msg, src->len);
-
- msg->job_id_s = strdup(src->job_id_s);
- msg->ev_len = src->ev_len;
- msg->es = src->es;
- msg->receipt_to = src->receipt_to;
- msg->offset = src->offset;
-#if defined(IL_NOTIFICATIONS)
- msg->dest_name = strdup(src->dest_name);
- msg->dest_port = src->dest_port;
- msg->dest = strdup(src->dest);
-#endif
- msg->expires = src->expires;
- return(msg);
-}
-
-
-int
-server_msg_init(struct server_msg *msg, il_octet_string_t *event)
-{
- il_http_message_t *hmsg = (il_http_message_t *)event;
-
- assert(msg != NULL);
- assert(event != NULL);
-
- memset(msg, 0, sizeof(*msg));
-
-
- msg->job_id_s = hmsg->host;
- if(msg->job_id_s == NULL) {
- set_error(IL_LBAPI, EDG_WLL_ERROR_PARSE_BROKEN_ULM, "server_msg_init: error getting id");
- return -1;
- }
- msg->len = create_msg(hmsg, &msg->msg, &msg->receipt_to, &msg->expires);
- if(msg->len < 0)
- return -1;
- /* set this to indicate new data owner */
- hmsg->data = NULL;
- hmsg->host = NULL;
- msg->ev_len = hmsg->len + 1; /* must add separator size too */
- return 0;
-
-}
-
-
-int
-server_msg_is_priority(struct server_msg *msg)
-{
- assert(msg != NULL);
-
- return(msg->receipt_to != 0);
-}
-
-
-int
-server_msg_free(struct server_msg *msg)
-{
- assert(msg != NULL);
-
- if(msg->msg) free(msg->msg);
- if(msg->job_id_s) free(msg->job_id_s);
- free(msg);
- return 0;
-}
+++ /dev/null
-#include "IlTestBase.h"
-
-#include <string.h>
-
-const char *IlTestBase::msg = "DATE=20040831150159.702224 HOST=\"some.host\" PROG=edg-wms LVL=USAGE DG.PRIORITY=0 DG.SOURCE=\"UserInterface\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"RegJob\" DG.JOBID=\"https://some.host:1234/x67qr549qc\" DG.SEQCODE=\"UI=2:NS=0:WM=0:BH=1:JSS=0:LM=0:LRMS=0:APP=0\" DG.USER=\"/C=CZ/O=Cesnet/CN=Michal Vocu\" DG.REGJOB.JDL=\"\" DG.REGJOB.NS=\"ns address\" DG.REGJOB.PARENT=\"\" DG.REGJOB.JOBTYPE=\"SIMPLE\" DG.REGJOB.NSUBJOBS=\"0\" DG.REGJOB.SEED=\"\"";
-
-const char *IlTestBase::msg_enc = " 429\n6 michal\n415 DATE=20040831150159.702224 HOST=\"some.host\" PROG=edg-wms LVL=USAGE DG.PRIORITY=0 DG.SOURCE=\"UserInterface\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"RegJob\" DG.JOBID=\"https://some.host:1234/x67qr549qc\" DG.SEQCODE=\"UI=2:NS=0:WM=0:BH=1:JSS=0:LM=0:LRMS=0:APP=0\" DG.USER=\"/C=CZ/O=Cesnet/CN=Michal Vocu\" DG.REGJOB.JDL=\"\" DG.REGJOB.NS=\"ns address\" DG.REGJOB.PARENT=\"\" DG.REGJOB.JOBTYPE=\"SIMPLE\" DG.REGJOB.NSUBJOBS=\"0\" DG.REGJOB.SEED=\"\"\n";
-
-const struct server_msg IlTestBase::smsg = {
- "https://some.host:1234/x67qr549qc",
- (char*)IlTestBase::msg_enc,
- strlen(IlTestBase::msg_enc),
- strlen(IlTestBase::msg) + 1,
- NULL
-};
+++ /dev/null
-extern "C" {
-#include "interlogd.h"
-}
-
-class IlTestBase {
-public:
- static const char *msg;
- static const char *msg_enc;
- static const struct server_msg smsg;
-};
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "IlTestBase.h"
-
-extern "C" {
-struct event_queue_msg {
- struct server_msg *msg;
- struct event_queue_msg *prev;
-};
-}
-
-#include <string>
-using namespace std;
-
-class event_queueTest: public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE( event_queueTest );
- CPPUNIT_TEST( testEventQueueCreate );
- CPPUNIT_TEST( testEventQueueInsert );
- CPPUNIT_TEST( testEventQueueGet );
- CPPUNIT_TEST( testEventQueueRemove );
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void setUp() {
- server = strdup("localhost:8080");
- eq = event_queue_create(server);
- free(server);
- }
-
- void tearDown() {
- struct event_queue_msg *mp;
- struct server_msg *m;
-
- for(mp = eq->head; mp != NULL; ) {
- struct event_queue_msg *mq;
-
- server_msg_free(mp->msg);
- mq = mp;
- mp = mp->prev;
- free(mq);
- }
- eq->head = NULL;
- event_queue_free(eq);
- }
-
- void testEventQueueCreate() {
- CPPUNIT_ASSERT( eq != NULL );
- CPPUNIT_ASSERT_EQUAL( string(eq->dest_name), string("localhost") );
- CPPUNIT_ASSERT_EQUAL( eq->dest_port, 8081 );
- CPPUNIT_ASSERT( eq->tail == NULL );
- CPPUNIT_ASSERT( eq->head == NULL );
- CPPUNIT_ASSERT( eq->tail_ems == NULL );
- CPPUNIT_ASSERT( eq->mark_this == NULL );
- CPPUNIT_ASSERT( eq->mark_prev == NULL );
- CPPUNIT_ASSERT( eq->thread_id == 0 );
- CPPUNIT_ASSERT( eq->flushing == 0 );
- CPPUNIT_ASSERT( eq->flush_result == 0 );
- }
-
- void testEventQueueInsert() {
- struct event_queue_msg *mp;
- struct server_msg *m;
-
- doSomeInserts();
- mp = eq->head;
- m = mp->msg;
- CPPUNIT_ASSERT_EQUAL( string(m->job_id_s), string("2") );
- CPPUNIT_ASSERT_EQUAL( mp, eq->tail_ems );
- mp = mp->prev;
- m = mp->msg;
- CPPUNIT_ASSERT_EQUAL( string(m->job_id_s), string("1") );
- mp = mp->prev;
- m = mp->msg;
- CPPUNIT_ASSERT_EQUAL( string(m->job_id_s), string("3") );
- CPPUNIT_ASSERT_EQUAL( mp, eq->tail );
- CPPUNIT_ASSERT( mp->prev == NULL );
- }
-
- void testEventQueueGet() {
- struct event_queue_msg *mp;
- struct server_msg *m,sm;
- int ret;
-
- doSomeInserts();
- mp = eq->head;
- eq->head = mp->prev;
- eq->tail_ems = NULL;
- server_msg_free(mp->msg);
- free(mp);
- ret = event_queue_get(eq, &m);
- CPPUNIT_ASSERT( ret == 0 );
- CPPUNIT_ASSERT( eq->mark_this == eq->head );
- CPPUNIT_ASSERT( eq->mark_prev == NULL );
- CPPUNIT_ASSERT_EQUAL( string("1"), string(m->job_id_s) );
- sm = IlTestBase::smsg;
- sm.job_id_s = "4";
- sm.receipt_to = 1;
- ret = event_queue_insert(eq, &sm);
- CPPUNIT_ASSERT( ret == 0 );
- CPPUNIT_ASSERT( eq->mark_prev == eq->head );
- CPPUNIT_ASSERT( eq->mark_this == eq->head->prev );
- ret = event_queue_insert(eq, &sm);
- CPPUNIT_ASSERT( ret == 0 );
- CPPUNIT_ASSERT( eq->mark_prev == eq->head->prev );
- CPPUNIT_ASSERT( eq->mark_this == eq->head->prev->prev );
- }
-
- void testEventQueueRemove() {
- struct event_queue_msg *mp;
- struct server_msg *m,sm;
- int ret;
-
- doSomeInserts();
- ret = event_queue_get(eq, &m);
- mp = eq->mark_this->prev;
- sm = IlTestBase::smsg;
- sm.job_id_s = "4";
- sm.receipt_to = 1;
- event_queue_insert(eq, &sm);
- ret = event_queue_remove(eq);
- CPPUNIT_ASSERT( eq->head->prev == mp );
- CPPUNIT_ASSERT( eq->mark_this == NULL );
- CPPUNIT_ASSERT( eq->mark_prev == NULL );
- }
-
-protected:
- char *server;
- struct event_queue *eq;
-
- void doSomeInserts() {
- struct server_msg m = IlTestBase::smsg;
-
- m.job_id_s = "1";
- event_queue_insert(eq, &m);
- m.receipt_to = 1;
- m.job_id_s = "2";
- event_queue_insert(eq, &m);
- m.job_id_s = "3";
- m.receipt_to = 0;
- event_queue_insert(eq, &m);
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( event_queueTest );
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "IlTestBase.h"
-
-class event_storeTest: public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE( event_storeTest );
- CPPUNIT_TEST( event_store_recoverTest );
- CPPUNIT_TEST( event_store_syncTest );
- CPPUNIT_TEST( event_store_nextTest );
- CPPUNIT_TEST( event_store_commitTest );
- CPPUNIT_TEST( event_store_cleanTest );
- CPPUNIT_TEST( event_store_findTest );
- CPPUNIT_TEST( event_store_releaseTest );
- CPPUNIT_TEST( event_store_initTest );
- CPPUNIT_TEST( event_store_recover_allTest );
- CPPUNIT_TEST( event_store_cleanupTest );
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void setUp() {
- }
-
- void tearDown() {
- }
-
- void event_store_recoverTest() {
- }
-
- void event_store_syncTest() {
- }
-
- void event_store_nextTest() {
- }
-
- void event_store_commitTest() {
- }
-
- void event_store_cleanTest() {
- }
-
- void event_store_findTest() {
- }
-
- void event_store_releaseTest() {
- }
-
- void event_store_initTest() {
- }
-
- void event_store_recover_allTest() {
- }
-
- void event_store_cleanupTest() {
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( event_storeTest );
+++ /dev/null
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-extern "C" {
-#include <pthread.h>
-#include "glite/wmsutils/tls/ssl_helpers/ssl_inits.h"
-#include "glite/wmsutils/tls/ssl_helpers/ssl_pthreads.h"
-#include "glite/security/glite_gss.h"
-#include "interlogd.h"
-#include "glite/lb/consumer.h"
-}
-
-#if defined(IL_NOTIFICATIONS)
-#define DEFAULT_PREFIX "/tmp/notif_events"
-#define DEFAULT_SOCKET "/tmp/notif_interlogger.sock"
-#else
-#define DEFAULT_PREFIX "/tmp/dglogd.log"
-#define DEFAULT_SOCKET "/tmp/interlogger.sock"
-#endif
-
-int TIMEOUT = DEFAULT_TIMEOUT;
-
-gss_cred_id_t cred_handle = GSS_C_NO_CREDENTIAL;
-pthread_mutex_t cred_handle_lock = PTHREAD_MUTEX_INITIALIZER;
-
-char *file_prefix = DEFAULT_PREFIX;
-int bs_only = 0;
-
-char *cert_file = NULL;
-char *key_file = NULL;
-char *CAcert_dir = NULL;
-char *log_server = NULL;
-char *socket_path = DEFAULT_SOCKET;
-
-
-int
-main (int ac,const char *av[])
-{
- CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
- CppUnit::TextUi::TestRunner runner;
-
- runner.addTest(suite);
- return runner.run() ? 0 : 1;
-}
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "IlTestBase.h"
-
-extern "C" {
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-#include "interlogd.h"
-
- extern char *socket_path;
-}
-
-#include <string>
-using namespace std;
-
-class input_queue_socketTest: public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE( input_queue_socketTest );
- CPPUNIT_TEST( input_queue_getTest );
- CPPUNIT_TEST_SUITE_END();
-
-public:
-
- void setUp() {
- struct sockaddr_un saddr;
- int sock;
- long offset = 0;
-
- int ret = input_queue_attach();
- CPPUNIT_ASSERT(ret == 0);
-
- sock=socket(PF_UNIX, SOCK_STREAM, 0);
- CPPUNIT_ASSERT(sock >= 0);
-
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, socket_path);
- ret = connect(sock, (struct sockaddr *)&saddr, sizeof(saddr.sun_path));
- CPPUNIT_ASSERT(ret >= 0);
-
- ret = write(sock, &offset, sizeof(offset));
- CPPUNIT_ASSERT( ret == sizeof(offset) );
- ret = write(sock, IlTestBase::msg, strlen(IlTestBase::msg));
- CPPUNIT_ASSERT( ret == strlen(IlTestBase::msg) );
- ret = write(sock, "\n", 1);
- CPPUNIT_ASSERT( ret == 1 );
- }
-
- void tearDown() {
- input_queue_detach();
- }
-
-
- void input_queue_getTest() {
- char *event;
- long offset;
- int ret;
-
- ret = input_queue_get(&event, &offset, 10);
- CPPUNIT_ASSERT( ret >= 0 );
- CPPUNIT_ASSERT_EQUAL( 0L, offset );
- CPPUNIT_ASSERT_EQUAL( string(IlTestBase::msg), string(event) );
- free(event);
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(input_queue_socketTest);
+++ /dev/null
-#include <iostream>
-
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-
-extern "C" {
-#define DEFAULT_SOCKET "/tmp/interlogger.sock"
-char *socket_path = DEFAULT_SOCKET;
-int edg_wll_log_proto_server(int *,char *,char *,int,int);
-void edg_wll_ll_log_init(int);
-}
-
-class LLTest: public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(LLTest);
- CPPUNIT_TEST(testProtoServer);
- CPPUNIT_TEST_SUITE_END();
-
-public:
-
- void setUp() {
- char *msg = "DATE=20040831150159.702224 HOST=\"some.host\" PROG=edg-wms LVL=USAGE DG.PRIORITY=0 DG.SOURCE=\"UserInterface\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"RegJob\" DG.JOBID=\"https://some.host:1234/x67qr549qc\" DG.SEQCODE=\"UI=2:NS=0:WM=0:BH=1:JSS=0:LM=0:LRMS=0:APP=0\" DG.REGJOB.JDL=\"\" DG.REGJOB.NS=\"ns address\" DG.REGJOB.PARENT=\"\" DG.REGJOB.JOBTYPE=\"SIMPLE\" DG.REGJOB.NSUBJOBS=\"0\" DG.REGJOB.SEED=\"\"";
- pipe(pd);
- log_proto_client(pd[1], msg);
- input_queue_attach();
- }
-
- void tearDown() {
- close(pd[0]);
- close(pd[1]);
- input_queue_detach();
- }
-
- void testProtoServer() {
- int ret;
- edg_wll_ll_log_init(255);
- ret = edg_wll_log_proto_server(&pd[0],
- "michal",
- "/tmp/dglogd.log",
- 0,
- 0);
- CPPUNIT_ASSERT( ret == 0 );
- }
-
-private:
- int pd[2];
-
- int log_proto_client(int con, char *logline) {
- char header[32];
- int err;
- int size;
- u_int8_t size_end[4];
-
- err = 0;
- size = strlen(logline)+1;
- size_end[0] = size & 0xff; size >>= 8;
- size_end[1] = size & 0xff; size >>= 8;
- size_end[2] = size & 0xff; size >>= 8;
- size_end[3] = size;
- size = strlen(logline)+1;
-
- err = write(con, "DGLOG", 5);
- CPPUNIT_ASSERT(err == 5);
- err = write(con, size_end, 4);
- CPPUNIT_ASSERT(err == 4);
- err = write(con, logline, size);
- CPPUNIT_ASSERT( err == size );
-}
-
- int sock;
- int accepted;
-
-int
-input_queue_attach()
-{
- struct sockaddr_un saddr;
-
- CPPUNIT_ASSERT((sock=socket(PF_UNIX, SOCK_STREAM, 0)) >= 0);
-
- memset(&saddr, 0, sizeof(saddr));
- saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, socket_path);
-
- CPPUNIT_ASSERT(bind(sock, (struct sockaddr *)&saddr, sizeof(saddr)) >= 0);
- CPPUNIT_ASSERT(listen(sock, 5) >= 0 );
- return(0);
-}
-
-void input_queue_detach()
-{
- if (sock >= 0)
- close(sock);
- unlink(socket_path);
-}
-
-};
-
-
-CPPUNIT_TEST_SUITE_REGISTRATION( LLTest );
-
-int
-main (int ac,const char *av[])
-{
- CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
- CppUnit::TextUi::TestRunner runner;
-
- runner.addTest(suite);
- return runner.run() ? 0 : 1;
-}
+++ /dev/null
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <signal.h>
-#include <string.h>
-#include <syslog.h>
-#include <fcntl.h>
-
-#define edg_wll_gss_read_full(a,b,c,d,e,f) test_edg_wll_gss_read_full(a,b,c,d,e,f)
-#define edg_wll_gss_write_full(a,b,c,d,e,f) test_edg_wll_gss_write_full(a,b,c,d,e,f)
-#define edg_wll_GssConnection int
-
-#include "logd_proto.h"
-#include "glite/lb/context-int.h"
-#include "glite/lb/escape.h"
-#include "glite/lb/events_parse.h"
-
-int
-test_edg_wll_gss_read_full(int *fd,
- void *buf,
- size_t bufsize,
- struct timeval *timeout,
- size_t *total,
- edg_wll_GssStatus *code)
-{
- *total = read(*fd, buf, bufsize);
- return(*total < 0 ? *total : 0);
-}
-
-int
-test_edg_wll_gss_write_full(int *fd,
- const void *buf,
- size_t bufsize,
- struct timeval *timeout,
- size_t *total,
- edg_wll_GssStatus *code)
-{
- return(0);
-}
-
-#include "logd_proto.c"
+++ /dev/null
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "IlTestBase.h"
-
-#include <string.h>
-
-using namespace std;
-
-class server_msgTest: public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(server_msgTest);
- CPPUNIT_TEST( server_msg_createTest );
- CPPUNIT_TEST( server_msg_copyTest );
- CPPUNIT_TEST_SUITE_END();
-
-public:
-
- void setUp() {
- msg = server_msg_create((char *)IlTestBase::msg);
- }
-
- void tearDown() {
- server_msg_free(msg);
- }
-
- void server_msg_createTest() {
- CPPUNIT_ASSERT( msg != NULL );
- CPPUNIT_ASSERT_EQUAL( string(msg->job_id_s), string(IlTestBase::smsg.job_id_s) );
- CPPUNIT_ASSERT_EQUAL( string(msg->msg), string(IlTestBase::smsg.msg) );
- CPPUNIT_ASSERT_EQUAL( msg->len, IlTestBase::smsg.len );
- CPPUNIT_ASSERT_EQUAL( msg->ev_len, IlTestBase::smsg.ev_len );
- CPPUNIT_ASSERT_EQUAL( msg->es, IlTestBase::smsg.es );
- CPPUNIT_ASSERT( !server_msg_is_priority(msg) );
- }
-
- void server_msg_copyTest() {
- struct server_msg *msg2;
-
- msg2 = server_msg_copy(msg);
- CPPUNIT_ASSERT( msg2 != NULL );
- CPPUNIT_ASSERT( msg2 != msg );
- CPPUNIT_ASSERT_EQUAL( string(msg->job_id_s), string(msg2->job_id_s) );
- CPPUNIT_ASSERT( msg->job_id_s != msg2->job_id_s);
- CPPUNIT_ASSERT_EQUAL( string(msg->msg), string(msg2->msg) );
- CPPUNIT_ASSERT( msg->msg != msg2->msg );
- CPPUNIT_ASSERT_EQUAL( msg->len, msg2->len );
- CPPUNIT_ASSERT_EQUAL( msg->ev_len, msg2->ev_len );
- CPPUNIT_ASSERT_EQUAL( msg->es, msg2->es );
- server_msg_free(msg2);
- }
-
-private:
- struct server_msg *msg;
-};
-
-
-CPPUNIT_TEST_SUITE_REGISTRATION(server_msgTest);
+++ /dev/null
-.project
-.cdtproject
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware\r
-================================\r
-\r
-Copyright (c) 2004 on behalf of the EU EGEE Project: \r
-The European Organization for Nuclear Research (CERN), \r
-Istituto Nazionale di Fisica Nucleare (INFN), Italy\r
-Datamat Spa, Italy\r
-Centre National de la Recherche Scientifique (CNRS), France\r
-CS Systeme d'Information (CSSI), France\r
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden\r
-Universiteit van Amsterdam (UvA), Netherlands\r
-University of Helsinki (UH.HIP), Finlan\r
-University of Bergen (UiB), Norway\r
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom\r
-\r
-Redistribution and use in source and binary forms, with or without\r
-modification, are permitted provided that the following conditions are\r
-met: \r
-\r
-1. Redistributions of source code must retain the above copyright\r
-notice, this list of conditions and the following disclaimer.\r
-\r
-2. Redistributions in binary form must reproduce the above copyright\r
-notice, this list of conditions and the following disclaimer in the\r
-documentation and/or other materials provided with the distribution.\r
-\r
-3. The end-user documentation included with the redistribution, if\r
-any, must include the following acknowledgment: "This product includes\r
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."\r
-Alternatively, this acknowledgment may appear in the software itself, if\r
-and wherever such third-party acknowledgments normally appear.\r
-\r
-4. The names EGEE and the EU EGEE Project must not be\r
-used to endorse or promote products derived from this software without\r
-prior written permission. For written permission, please contact\r
-<email address>.\r
-\r
-5. You are under no obligation whatsoever to provide anyone with any\r
-bug fixes, patches, or upgrades to the features, functionality or\r
-performance of the Software ("Enhancements") that you may develop over\r
-time; however, if you choose to provide your Enhancements to The EU\r
-EGEE Project, or if you choose to otherwise publish or distribute your\r
-Enhancements, in source code form without contemporaneously requiring\r
-end users of The EU EGEE Proejct to enter into a separate written license\r
-agreement for such Enhancements, then you hereby grant The EU EGEE Project\r
-a non-exclusive, royalty-free perpetual license to install, use, copy,\r
-modify, prepare derivative works, incorporate into the EGEE Middleware\r
-or any other computer software, distribute, and sublicense your\r
-Enhancements or derivative works thereof, in binary and source code\r
-form (if any), whether developed by The EU EGEE Project or third parties.\r
-\r
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED\r
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE\r
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-This software consists of voluntary contributions made by many\r
-individuals on behalf of the EU EGEE Prject. For more information on The\r
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on\r
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/\r
-\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite Middleware Loggin and Bookkeeping Subsystem
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.43.2.1 2007/03/29 20:05:00 akrenek
- disable utils temporarily
-
- Revision 1.43 2007/03/21 13:10:38 akrenek
- utils -> jp.primary (sync with 3.1)
-
- Revision 1.42 2006/03/24 08:26:11 akrenek
- missing utils->client dependency (should fix nightly build)
-
- Revision 1.41 2006/03/15 17:35:35 akrenek
- cares
-
- Revision 1.40 2006/03/15 17:33:24 akrenek
- merge of 1.5 branch
-
- Revision 1.39 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.38 2005/11/22 12:13:47 eronchie
- Removed one utils
-
- Revision 1.37 2005/11/04 14:39:20 akrenek
- merge in the "lbonly" hack
-
- Revision 1.36.4.6 2006/02/06 12:10:00 akrenek
- make proxy depend on logger explicitely
-
- Revision 1.36.4.5 2005/12/02 11:15:33 akrenek
- resolved logger dependency conflict
-
- Revision 1.36.4.4 2005/12/02 10:04:14 jpospi
- server depends on logger
-
- Revision 1.36.4.3 2005/11/28 10:39:08 akrenek
- merge bug #13928 fix on the pre_cares branch
-
- Revision 1.36.4.2 2005/11/24 12:59:36 akrenek
- server depends on bones
-
- Revision 1.36.4.1 2005/11/24 12:32:02 akrenek
- merged in "lbonly"
-
- Revision 1.39 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.38 2005/11/22 12:13:47 eronchie
- Removed one utils
-
- Revision 1.37 2005/11/04 14:39:20 akrenek
- merge in the "lbonly" hack
-
- Revision 1.36 2005/10/15 13:36:26 akrenek
- added lb.utils
-
- Revision 1.35 2005/10/14 17:19:08 akrenek
- build also lb.utils
-
- Revision 1.34 2005/10/14 11:02:06 akrenek
- depends on jp.primary
-
- Revision 1.33 2005/09/19 15:23:45 akrenek
- "The gigantic merge"; from release 1.4 branch to HEAD
-
- Revision 1.32.2.2 2005/10/31 12:45:10 akrenek
- conditional disabling of cross-subsystem builds via "lbonly" property
-
- Revision 1.32.2.1 2005/08/18 10:36:05 eronchie
- Added cross-subsystem dependencies feature in org.glite.lb subsystem.
- Added wms-utils.jobid and security.gsoap-plugin among common dependencies.
- Added security.voms among server dependencies.
- At the moment I have not consider gridsite.core component.
- Once built gridsiste component, run ant in org.glite.lb to build the whole lb
- and its external gLite dependencies.
-
- Revision 1.32 2005/08/03 11:58:25 akrenek
- Merged the release 1.0 branch
-
- Revision 1.31 2005/05/26 15:13:37 zurek
- inserted module.build.file
-
- Revision 1.30 2005/03/17 09:59:31 zsalvet
- Add proxy target.
-
- Revision 1.29 2005/03/16 10:02:52 zsalvet
- proxy component added
-
- Revision 1.28.2.1 2005/02/12 01:38:13 glbuild
- Changed start time
-
- Revision 1.28 2004/11/29 15:16:26 zsalvet
- Add ws-interface to checkout/build machinery.
-
- Revision 1.27 2004/11/29 13:55:02 akrenek
- added dependence on ws-interface
-
- Revision 1.26 2004/10/29 22:53:41 dimeglio
- Use envset target
-
- Revision 1.25 2004/10/28 22:57:36 dimeglio
- Quoted ant command line parameters
-
- Revision 1.24 2004/10/28 18:19:30 dimeglio
- Added envcheck to individual components
-
- Revision 1.23 2004/10/26 15:12:06 dimeglio
- Fixed spelling error in envchecks
-
- Revision 1.22 2004/10/26 13:11:13 dimeglio
- Added dependency of clean on envchecks
-
- Revision 1.21 2004/10/25 20:57:38 dimeglio
- Use antExec
-
- Revision 1.20 2004/10/21 10:37:48 akrenek
- make server depend on logger due to notification interlogger
-
- Revision 1.19 2004/10/15 12:30:01 akrenek
- build with lb.sever-bones
-
- Revision 1.18 2004/09/29 13:35:39 flammer
- Only update of line formatting.
-
- Revision 1.17 2004/09/09 21:05:29 dimeglio
- Moved tag target to targets-common
-
- Revision 1.16 2004/08/27 03:03:12 dimeglio
- Preserve original timestamp when copying file and overwrite when new
-
- Revision 1.15 2004/08/27 02:46:52 dimeglio
- Added logic to create the tagged dependencies properties file
-
- Revision 1.14 2004/08/26 23:48:26 dimeglio
- Added generation of cruisecontrol config file entry
-
- Revision 1.13 2004/08/09 04:56:14 dimeglio
- Replaced rtag with tag
-
- Revision 1.12 2004/08/09 04:36:44 dimeglio
- Fixed inheritance of do.cvs.tag property
-
- Revision 1.11 2004/08/09 03:06:11 dimeglio
- Fixed inheritance of failonerror property
-
- Revision 1.10 2004/08/09 02:35:35 dimeglio
- Set default value for failonerror
-
- Revision 1.9 2004/08/08 19:07:17 dimeglio
- Added small.memory type of build
-
- Revision 1.8 2004/07/29 10:47:46 dimeglio
- Added server and logger
-
- Revision 1.7 2004/07/29 07:39:57 dimeglio
- Removed local envinfo and envcheck target (must use common ones)
-
- Revision 1.6 2004/07/16 16:25:43 flammer
- Added tags for automated adding of components.
-
- Revision 1.5 2004/07/06 17:43:33 flammer
- Update of classpath definitions, targets & configure file.
-
- Revision 1.4 2004/06/23 00:24:03 dimeglio
- Added common and client modules
-
- Revision 1.3 2004/06/22 18:24:35 dimeglio
- Added client interface module
-
- Revision 1.2 2004/06/18 23:05:12 dimeglio
- Added/upgraded default build scripts
-
--->
-
-<project name="lb" default="dist">
-
- <description>
- Ant build file to build the GLite Logging and Bookkeping Subsystem
- </description>
-
- <!-- =========================================
- Builds the GLite LB subsystem
- ========================================= -->
-
- <!-- Import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- Import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="./project/properties.xml" />
-
- <!-- Import global build properties and global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependencies properties files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${subsystem.dependencies.file}"/>
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options
- ========================================= -->
- <import file="${global.configure.options.file}"/>
-
- <!-- =========================================
- Import global task definitions
- ========================================= -->
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Import global compiler definitions
- ========================================= -->
- <import file="${global.compilerdefs.file}" />
-
- <!-- =========================================
- Import targets
- ========================================= -->
- <import file="${global.targets-common.file}"/>
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ===============================================
- Public common targets
- =============================================== -->
-
- <target name="localinit" depends="envcheck">
-
- <echo> Preparing directories ... </echo>
-
- <mkdir dir="${stage.bin.dir}" />
- <mkdir dir="${stage.lib.dir}" />
- <mkdir dir="${stage.java.dir}" />
- <mkdir dir="${stage.inc.dir}" />
- <mkdir dir="${stage.int.dir}" />
-
- <mkdir dir="${dist.dir}" />
-
- </target>
-
- <target name="init" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="init"/>
- </antcall>
- </target>
-
- <target name="checkstyle" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="checkstyle"/>
- </antcall>
- </target>
-
- <target name="compile" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="compile"/>
- </antcall>
- </target>
-
- <target name="compiletest" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="compiletest"/>
- </antcall>
- </target>
-
- <target name="unittest" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="unittest"/>
- </antcall>
- </target>
-
- <target name="unitcoverage" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="unitcoverage"/>
- </antcall>
- </target>
-
- <target name="stage" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="stage"/>
- </antcall>
- </target>
-
- <target name="dist" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="dist"/>
- </antcall>
- </target>
-
- <target name="install" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="install"/>
- </antcall>
- </target>
-
- <target name="doc" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="doc"/>
- </antcall>
- </target>
-
- <target name="all" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="all"/>
- </antcall>
- </target>
-
- <target name="clean" depends="envcheck">
-
- <property name="offline.repository" value="true" />
- <antcall target="buildmodules">
- <param name="target" value="clean"/>
- </antcall>
-
- <delete dir="${module.bin.dir}" />
- <delete dir="${module.lib.dir}" />
- <delete dir="${module.autosrc.dir}" />
- <delete dir="${module.autodoc.dir}" />
- <delete dir="${module.test.reports.dir}" />
-
- </target>
-
- <target name="cleanAll" depends="clean"/>
-
- <!-- ===============================================
- Private targets
- =============================================== -->
-
- <!-- ===============================================
- Modules proxy targets
- =============================================== -->
-
- <!-- component targets definitions tag = do not remove = -->
-
- <target name="security.gsoap-plugin" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${security.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="gsoap-plugin -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${security.subsystem.dir}"
- target="gsoap-plugin"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="security.voms-api-c" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${security.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="voms-api-c -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${security.subsystem.dir}"
- target="voms-api-c"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="wms-utils.jobid" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${wms-utils.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="jobid -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${wms-utils.subsystem.dir}"
- target="jobid"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="jp.primary" unless="lbonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${jp.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="primary -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}"
- target="primary"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <if>
- <isset property="setenvonly"/>
- <then>
- <property name="lbonly" value="yes"/>
- </then>
- </if>
-
- <target name="client-interface" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.client-interface" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.client-interface"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="ws-interface" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.ws-interface" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.ws-interface"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="server-bones" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.server-bones" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.server-bones"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="common" unless="setenvonly" depends="envset, globus, expat, c-ares, wms-utils.jobid, security.gsoap-plugin, client-interface">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.common" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.common"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="client" unless="setenvonly" depends="envset, globus, expat, c-ares, client-interface, common">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.client" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.client"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="server" unless="setenvonly" depends="envset, globus, expat, c-ares, mysql, gsoap, security.voms-api-c, jp.primary, client-interface, ws-interface, common, server-bones, logger">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.server" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.server"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="proxy" unless="setenvonly" depends="envset, globus, expat, c-ares, client-interface, common, server, logger">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.proxy" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.proxy"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="logger" unless="setenvonly" depends="envset, globus, expat, c-ares, client-interface, common">
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${lb.subsystem.dir}.logger" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.logger"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="utils" unless="setenvonly" depends="envset, globus, expat, c-ares, client, server, jp.primary">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${lb.subsystem.dir}.utils" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}.utils"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <!-- Main proxy -->
-<!--XXX: until JP from head is included utils, -->
- <target name="buildmodules" depends="envset,
- client-interface,
- ws-interface,
- client,
- server-bones,
- common,
- server,
- proxy,
- logger">
- <echo append="true" file="${global.project.dir}/cruisecontrol-stub.xml">
- <project name="${subsystem.name}" type="post-subsystem" packageName="${global.prefix}-${subsystem.prefix}"/>
- </echo>
- </target>
-
-</project>
+++ /dev/null
-#!/usr/bin/perl
-
-# WARNING: Don't edit this file unless it is the master copy in org.glite.lb
-#
-# For the purpose of standalone builds of lb/jobid/lbjp-common components
-# it is copied on tagging
-
-# $Header$
-
-use Getopt::Long;
-
-my $pwd = `pwd`; chomp $pwd;
-my $prefix = $pwd.'/stage';
-my $stagedir;
-my $staged;
-my $module;
-my $thrflavour = 'gcc64dbgpthr';
-my $nothrflavour = 'gcc64dbg';
-my $mode = 'build';
-my $help = 0;
-my $listmodules;
-my $version;
-my $output;
-my $lb_tag = '';
-my $lbjp_tag = '';
-my $jp_tag = '';
-my $sec_tag = '';
-my $jobid_tag = '';
-my $libdir = 'lib';
-
-my @nodes = qw/client server logger utils doc ws-test db jpprimary jpindex jpclient/;
-my %enable_nodes;
-my %disable_nodes;
-
-my %extern_prefix = (
- cares => '/opt/c-ares',
- classads => '/opt/classads',
- cppunit => '/usr',
- expat => '/usr',
- globus => '/opt/globus',
- jglobus => '/opt/globus',
- gsoap => '/usr',
- mysql => '/usr',
- 'mysql-devel' => '',
- 'mysql-server' => '',
- voms => '/opt/glite',
- gridsite => '/opt/glite',
- lcas => '/opt/glite',
- ant => '/usr',
- jdk => '/usr',
- libtar => '/usr',
-);
-
-my %jar = (
- 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar',
-);
-
-
-my %glite_prefix;
-my %need_externs;
-my %need_externs_type;
-my %need_jars;
-my %extrafull;
-my %extranodmod;
-my %deps;
-my %deps_type;
-my %topbuild;
-
-my %lbmodules = (
- 'lb' => [ qw/client common doc logger server state-machine types utils ws-interface ws-test glite-LB/],
- 'security' => [qw/gss gsoap-plugin/],
- 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/],
- 'jobid' => [qw/api-c api-cpp/],
- 'jp' => [ qw/client doc index primary server-common ws-interface/ ],
- );
-
-
-my @opts = (
- 'prefix=s' => \$prefix,
- 'staged=s' => \$staged,
- 'module=s' => \$module,
- 'thrflavour=s' => \$thrflavour,
- 'nothrflavour=s' => \$nothrflavour,
- 'mode=s' => \$mode,
- 'listmodules=s' => \$listmodules,
- 'version=s' => \$version,
- 'output=s' => \$output,
- 'stage=s' => \$stagedir,
- 'lb-tag=s' => \$lb_tag,
- 'lbjp-common-tag=s' => \$lbjp_tag,
- 'jp-tag=s' => \$jp_tag,
- 'security-tag=s' => \$sec_tag,
- 'jobid-tag=s' => \$jobid_tag,
- 'help' => \$help,
- 'libdir=s' => \$libdir,
-);
-
-for (@nodes) {
- $enable_nodes{$_} = 0;
- $disable_nodes{$_} = 0;
-
- push @opts,"disable-$_",\$disable_nodes{$_};
- push @opts,"enable-$_",\$enable_nodes{$_};
-}
-
-push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix;
-push @opts,"with-$_=s",\$jar{$_} for keys %jar;
-
-my @keeparg = @ARGV;
-
-GetOptions @opts or die "Errors parsing command line\n";
-
-$extern_prefix{'mysql-devel'}=$extern_prefix{mysql} if $extern_prefix{'mysql-devel'} eq '';
-$extern_prefix{'mysql-server'}=$extern_prefix{mysql} if $extern_prefix{'mysql-server'} eq '';
-
-if ($help) { usage(); exit 0; }
-
-if ($listmodules) {
- my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}};
- print "@m\n";
- exit 0;
-}
-
-warn "$0: --version and --output make sense only in --mode=etics\n"
- if ($version || $output) && $mode ne 'etics';
-
-my $en;
-for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; }
-
-my $dis;
-for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; }
-
-die "--enable-* and --disable-* are mutually exclusive\n"
- if $en && $dis;
-
-die "--module cannot be used with --enable-* or --disable-*\n"
- if $module && ($en || $dis);
-
-die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}};
-
-if ($dis) {
- for (@nodes) {
- $enable_nodes{$_} = 1 unless $disable_nodes{$_};
- }
-}
-
-if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ;
-
-for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; }
-
-$stagedir = $prefix unless $stagedir;
-
-if ($mode eq 'build') {
- print "Writing config.status\n";
- open CONF,">config.status" or die "config.status: $!\n";
- print CONF "$0 @keeparg\n";
- close CONF;
-}
-
-
-my @modules;
-my %aux;
-
-if ($module) {
-# push @modules,split(/[,.]+/,$module);
- push @modules,$module;
-}
-else {
- @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes));
-
- my $n;
-
- do {
- local $"="\n";
- $n = $#modules;
- push @modules,(map @{$deps{$_}},@modules);
-
- undef %aux; @aux{@modules} = (1) x ($#modules+1);
- @modules = keys %aux;
- } while ($#modules > $n);
-}
-
-@aux{@modules} = (1) x ($#modules+1);
-delete $aux{$_} for (split /,/,$staged);
-@modules = keys %aux;
-
-mode_build() if $mode eq 'build';
-mode_checkout() if $mode eq 'checkout';
-mode_etics($module) if $mode eq 'etics';
-
-sub mode_build {
- print "\nBuilding modules: @modules\n";
-
- my @ext = map @{$need_externs{$_}},@modules;
- my @myjars = map @{$need_jars{$_}},@modules;
- undef %aux; @aux{@ext} = 1;
- @ext = keys %aux;
- undef %aux; @aux{@myjars} = (1) x ($#myjars+1);
- @myjars = keys %aux;
-
- print "\nRequired externals:\n";
- print "\t$_: $extern_prefix{$_}\n" for @ext;
- print "\t$_: $jar{$_}\n" for @myjars;
- print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n";
-
- mkinc($_) for @modules;
-
- print "Creating Makefile\n";
-
- open MAK,">Makefile" or die "Makefile: $!\n";
-
- print MAK "all: @modules\n\nclean:\n";
-
- for (@modules) {
- my $full = full($_);
- my $build = $topbuild{$_} ? '': '/build';
- print MAK "\tcd $full$build && \${MAKE} clean\n"
- }
-
- print MAK "\ndistclean:\n";
-
- for (@modules) {
- my $full = full($_);
- print MAK $topbuild{$_} ?
- "\tcd $full$build && \${MAKE} distclean\n" :
- "\trm -rf $full$build\n"
- }
-
- print MAK "\n";
-
- for (@modules) {
- my %ldeps; undef %ldeps;
- @ldeps{@{$deps{$_}}} = 1;
- for my $x (split /,/,$staged) { delete $ldeps{$x}; }
- my @dnames = $module ? () : keys %ldeps;
-
- my $full = full($_);
- my $build = $topbuild{$_} ? '': '/build';
-
- print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n";
- }
-
- close MAK;
-}
-
-sub mode_checkout() {
- for (@modules) {
- my $module = $_;
- my $tag = "";
- if ($lb_tag){
- for (@{$lbmodules{lb}}){
- if ("lb.".$_ eq $module){
- $tag = '-r '.$lb_tag;
- }
- }
- }
- if ($lbjp_tag){
- for (@{$lbmodules{'lbjp-common'}}){
- if ("lbjp-common.".$_ eq $module){
- $tag = '-r '.$lbjp_tag;
- }
- }
- }
- if ($jp_tag){
- for (@{$lbmodules{'jp'}}){
- if ("jp.".$_ eq $module){
- $tag = '-r '.$jp_tag;
- }
- }
- }
- if ($sec_tag){
- for (@{$lbmodules{security}}){
- if ("security.".$_ eq $module){
- $tag = '-r '.$sec_tag;
- }
- }
- }
- if ($jobid_tag){
- for (@{$lbmodules{jobid}}){
- if ("jobid.".$_ eq $module){
- $tag = '-r '.$jobid_tag;
- }
- }
- }
- #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){
- # print "found";
- #}
- $_ = full($_);
- print "\n*** Checking out $_\n";
- system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n";
- }
-}
-
-BEGIN{
-%need_externs_aux = (
- 'lb.client' => [ qw/cppunit:B classads/ ],
- 'lb.client-java' => [ qw/ant:B jglobus jdk:B/ ],
- 'lb.common' => [ qw/expat cppunit:B classads/ ],
- 'lb.doc' => [],
- 'lb.logger' => [ qw/cppunit:B/ ],
- 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite/ ],
- 'lb.state-machine' => [ qw/classads/ ],
- 'lb.utils' => [ qw/cppunit:B/ ],
- 'lb.ws-interface' => [],
- 'lb.ws-test' => [ qw/gsoap:B/ ],
- 'lb.types' => [ qw// ],
- 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R yaim:R/ ],
- 'lbjp-common.db' => [ qw/mysql:R mysql-devel:B/ ],
- 'lbjp-common.maildir' => [ qw// ],
- 'lbjp-common.server-bones' => [ qw// ],
- 'lbjp-common.trio' => [ qw/cppunit:B/ ],
- 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ],
- 'security.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B/ ],
- 'security.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares gsoap:B/ ],
- 'jobid.api-c' => [ qw/cppunit:B/ ],
- 'jobid.api-cpp' => [ qw/cppunit:B/ ],
- 'jobid.api-java' => [ qw/ant:B jdk:B/ ],
- 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ],
- 'jp.doc' => [],
- 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ],
- 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ],
- 'jp.server-common' => [],
- 'jp.ws-interface' => [],
-);
-
-for my $ext (keys %need_externs_aux) {
- for (@{$need_externs_aux{$ext}}) {
- /([^:]*)(?::(.*))?/;
- push @{$need_externs{$ext}},$1;
- my $type = $2 ? $2 : 'BR';
- $need_externs_type{$ext}->{$1} = $type;
- }
-}
-
-%need_jars = (
- 'jobid.api-java' => [ qw/commons-codec/ ],
-);
-
-for my $jar (keys %need_jars) {
- for (@{$need_jars{$jar}}) {
- $need_externs_type{$jar}->{$_} = 'BR'; # XXX
- }
-}
-
-%deps_aux = (
- 'lb.client' => [ qw/
- lb.types:B lb.common
- lbjp-common.trio
- jobid.api-cpp:B jobid.api-c
- security.gss
- / ],
- 'lb.client-java' => [ qw/
- lb.types:B
- jobid.api-java
- / ],
- 'lb.common' => [ qw/
- jobid.api-cpp:B jobid.api-c
- lb.types:B lbjp-common.trio security.gss
- / ],
- 'lb.doc' => [ qw/lb.types:B/ ],
- 'lb.logger' => [ qw/
- lbjp-common.trio
- jobid.api-c
- lb.common
- security.gss
- / ],
- 'lb.server' => [ qw/
- lb.ws-interface lb.types:B lb.common lb.state-machine
- lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir
- jobid.api-c
- security.gsoap-plugin security.gss
- / ],
- 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface security.gss/ ],
- 'lb.utils' => [ qw/
- lbjp-common.jp-interface
- jobid.api-c
- lbjp-common.trio lbjp-common.maildir
- lb.client lb.state-machine
- / ],
- 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ],
- 'lb.ws-interface' => [ qw/lb.types:B/ ],
- 'lb.types' => [ qw// ],
- 'lb.glite-LB' => [ qw/
- lb.logger:R lb.server:R lb.utils:R lb.doc:R
- lb.ws-test:R
- / ],
- 'lbjp-common.db' => [ qw/lbjp-common.trio/ ],
- 'lbjp-common.maildir' => [ qw// ],
- 'lbjp-common.server-bones' => [ qw// ],
- 'lbjp-common.trio' => [ qw// ],
- 'security.gss' => [ qw// ],
- 'security.gsoap-plugin' => [ qw/security.gss/ ],
- 'jobid.api-c' => [ qw// ],
- 'jobid.api-cpp' => [ qw/jobid.api-c/ ],
- 'jobid.api-java' => [ qw// ],
-
- 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ],
-
- 'jp.client' => [ qw/
- jp.ws-interface
- lbjp-common.jp-interface lbjp-common.maildir
- jobid.api-c
- security.gsoap-plugin
- / ],
- 'jp.doc' => [ qw// ],
- 'jp.index' => [ qw/
- jp.server-common jp.ws-interface
- lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
- security.gsoap-plugin
- / ],
- 'jp.primary' => [ qw/
- jobid.api-c
- jp.server-common jp.ws-interface
- lb.state-machine
- lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
- security.gsoap-plugin
- / ],
- 'jp.server-common' => [ qw/
- lbjp-common.jp-interface lbjp-common.db
- / ],
- 'jp.ws-interface' => [ qw// ],
-);
-
-for my $ext (keys %deps_aux) {
- for (@{$deps_aux{$ext}}) {
- /([^:]*)(?::(.*))?/;
- push @{$deps{$ext}},$1;
- my $type = $2 ? $2 : 'BR';
- $deps_type{$ext}->{$1} = $type;
- }
-}
-
-
-%extrafull = ( gridsite=>'org.gridsite.core');
-
-#( java => 'client-java' );
-%extranodmod = (
- db => 'lbjp-common.db',
- jpprimary => 'jp.primary',
- jpindex => 'jp.index',
- jpclient => 'jp.client',
-);
-
-my @t = qw/lb.client-java jobid.api-java lb.types/;
-@topbuild{@t} = (1) x ($#t+1);
-}
-
-sub full
-{
- my $short = shift;
- return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short;
-}
-
-sub mkinc
-{
- my %aux;
- undef %aux;
- my @m=qw/
-lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java
-security.gss security.gsoap-plugin
-jobid.api-c jobid.api-cpp jobid.api-java
-lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface
-jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface
-/;
- @aux{@m} = (1) x ($#m+1);
-
- my $short = shift;
- my $full = full $short;
-
- unless ($aux{$short}) {
- print "Makefile.inc not needed in $full\n";
- return;
- }
-
- my $build = '';
-
- unless ($topbuild{$_}) {
- $build = '/build';
- unless (-d "$full/build") {
- mkdir "$full/build" or die "mkdir $full/build: $!\n";
- }
- unlink "$full/build/Makefile";
- symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n";
- }
-
- open MKINC,">$full$build/Makefile.inc"
- or die "$full$build/Makefile.inc: $!\n";
-
- print "Creating $full$build/Makefile.inc\n";
-
- print MKINC qq{
-PREFIX = $prefix
-stagedir = $stagedir
-thrflavour = $thrflavour
-nothrflavour = $nothrflavour
-libdir = $libdir
-};
-
- for (@{$need_externs{$short}}) {
- print MKINC "${_}_prefix = $extern_prefix{$_}\n"
- }
-
- for (@{$need_jars{$short}}) {
- print MKINC "${_}_jar = $jar{$_}\n"
- }
-
- my $need_gsoap = 0;
- for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; }
-
- print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap;
-
- close MKINC;
-}
-
-my %etics_externs;
-my %etics_projects;
-BEGIN{
- %etics_externs = (
- globus_essentials=>'vdt_globus_essentials',
- globus=>'globus',
- cares=>'c-ares',
- voms=>'org.glite.security.voms-api-cpp',
- gridsite=>'org.gridsite.shared',
- lcas=>'org.glite.security.lcas',
- trustmanager=>'org.glite.security.trustmanager',
- utiljava=>'org.glite.security.util-java',
- yaim=>'org.glite.yaim.lb',
- gpt=>'gpt',
- fetchcrl=>'fetch-crl',
- gip_release=>'glite-info-provider-release',
- gip_service=>'glite-info-provider-service',
- bdii=>'bdii',
- glite_version=>'glite-version',
- glite_info_templates=>'glite-info-templates',
- glue_schema=>'glue-schema',
- );
- %etics_projects = (
- vdt=>[qw/globus globus_essentials/],
- 'org.glite'=>[qw/voms gridsite lcas gpt gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim/],
- );
-};
-
-sub mode_etics {
- $fmod = shift;
-
- die "$0: --module required with --etics\n" unless $fmod;
-
- my ($subsys,$module) = split /\./,$fmod;
-
- my ($major,$minor,$rev,$age);
-
- if ($version) {
- $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/;
- ($major,$minor,$rev,$age) = ($1,$2,$3,$4);
- }
- else {
- open V,"org.glite.$subsys.$module/project/version.properties"
- or die "org.glite.$subsys.$module/project/version.properties: $!\n";
-
- while ($_ = <V>) {
- chomp;
- ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/;
- $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/;
- }
- close V;
- }
-
- my @copts = ();
- my %ge;
- @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1);
-
- for (@{$need_externs{"$subsys.$module"}}) {
- if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
- push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}";
- }
- }
-
- for (@{$need_jars{"$subsys.$module"}}) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
-
- push @copts,"--with-$_ \${$eext.location}/$_*.jar";
- }
-
-
- my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}";
- my $file = $output ? $output : "$conf.ini";
- open C,">$file" or die "$file: $!\n";
-
- my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n";
-
- my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..';
-
- print STDERR "Writing $file\n";
- print C qq{
-[Configuration-$conf]
-profile = None
-moduleName = org.glite.$subsys.$module
-displayName = $conf
-description = org.glite.$subsys.$module
-projectName = org.glite
-age = $age
-deploymentType = None
-tag = $conf
-version = $major.$minor.$rev
-path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz
-
-[Platform-default:VcsCommand]
-displayName = None
-description = None
-tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName}
-branch = None
-commit = None
-checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName}
-
-[Platform-default:BuildCommand]
-postpublish = None
-packaging = None
-displayName = None
-description = None
-doc = None
-prepublish = None
-publish = None
-compile = make
-init = None
-install = make install
-clean = make clean
-test = make check
-configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --libdir=\${libdir} --module $subsys.$module @copts
-checkstyle = None
-
-[Platform-default:Property]
-$buildroot
-
-[Platform-default:DynamicDependency]
-
-};
- for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) {
- my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
-
- my $proj = 'externals';
- for my $p (keys %etics_projects) {
- for $m (@{$etics_projects{$p}}) {
- $proj = $p if $m eq $_;
- }
- }
-
- my $type = $need_externs_type{"$subsys.$module"}->{$_};
- print C "$proj|$eext = $type\n";
- }
-
- for (@{$deps{"$subsys.$module"}}) {
- my $type = $deps_type{"$subsys.$module"}->{$_};
- print C "org.glite|org.glite.$_ = $type\n";
- }
-
- close C;
-}
-
-sub gsoap_version {
- local $_;
- my $gsoap_version;
- open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n";
-
- while ($_ = <S>) {
- chomp;
-
- $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/;
- }
- close S;
- return $gsoap_version;
-}
-
-
-sub usage {
- my @ext = keys %extern_prefix;
- my @myjars, keys %jar;
-
- print STDERR qq{
-usage: $0 options
-
-General options (defaults in []):
- --prefix=PREFIX destination directory [./stage]
- --staged=module,module,... what is already in PREFIX (specify without org.glite.)
- --thrflavour=flavour
- --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg]
- --listmodules=subsys list modules of a subsystem
- --libdir=libdir typically [lib,lib64] postfix
-
-Mode of operation:
- --mode={checkout|build|etics} what to do [build]
-
-What to build:
- --module=module build this module only (mostly in-Etics operation)
- --enable-NODE build this "node" (set of modules) only. Available nodes are
- @{$lbmodules{lb}},@{$lbmodules{security}}
- --disable-NODE don't build this node
- --lb-tag=tag checkout LB modules with specific tag
- --jp-tag=tag checkout JP modules with specific tag
- --lbjp-common-tag=tag checkout lbjp-common modules with specific tag
- --security-tag=tag checkout security modules with specific tag
- --jobid-tag=tag checkout jobid modules with specific tag
-
-Dependencies:
- --with-EXTERNAL=PATH where to look for an external. Required externals
- (not all for all modules) are:
- @ext
- --with-JAR=JAR where to look for jars. Required jars are:
- @myjars
- Summary of what will be used is always printed
-
-};
-
-}
+++ /dev/null
-deploy_all.diff - against RC31
-deploy_lb, deploy_jp - older patches
+++ /dev/null
-Index: org.glite/project/global.dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite/project/global.dependencies.properties,v
-retrieving revision 1.482.2.279.2.61
-diff -u -r1.482.2.279.2.61 global.dependencies.properties
---- org.glite/project/global.dependencies.properties 23 Apr 2007 09:54:21 -0000 1.482.2.279.2.61
-+++ org.glite/project/global.dependencies.properties 24 Apr 2007 08:20:35 -0000
-@@ -2100,6 +2100,24 @@
- ext.globus-sdk.rpm.version = ${ext.vdt.version}
- ext.globus-sdk.rpm.age = ${ext.vdt.age}
-
-+# Globus vdt data server - grid ftp server
-+ext.globus-data-server.name = ${ext.globus.name}
-+ext.globus-data-server.vendor = ${ext.globus.vendor}
-+ext.globus-data-server.version = ${ext.globus.version}
-+ext.globus-data-server.platform = ${platform}
-+ext.globus-data-server.subdir = ${ext.globus-data-server.name}/${ext.globus-data-server.version}/${ext.globus-data-server.platform}
-+ext.globus-data-server.rep.base = ${jra1.rep.base}
-+ext.globus-data-server.rep.file =
-+ext.globus-data-server.rep.subdir =
-+ext.globus-data-server.rep.url = ${ext.globus-data-server.rep.base}/${ext.globus-data-server.subdir}/${ext.globus-data-server.rep.subdir}/${ext.globus-data-server.rep.file}
-+ext.globus-data-server.files =
-+ext.globus-data-server.download = http://www.cs.wisc.edu/vdt/releases/1.2.2/installing-rpms.html
-+ext.globus-data-server.homepage = http://www.cs.wisc.edu/vdt//index.html
-+ext.globus-data-server.description = The Globus Toolkit(R). This is the version packaged by VDT.
-+ext.globus-data-server.rpm.name = vdt_globus_data_server
-+ext.globus-data-server.rpm.version = ${ext.vdt.version}
-+ext.globus-data-server.rpm.age = 1
-+
- # google-perftools
- ext.google-perftools.name = google-perftools
- ext.google-perftools.vendor = google-perftools
-@@ -3855,31 +3873,31 @@
- # System dependencies
- ###################################################################
-
--org.glite.deployment.version = glite-deployment_branch_2_5_0
-+org.glite.deployment.version = HEAD
- org.glite.testsuites.version = HEAD
--org.glite.version = glite_branch_3_1_0
-+org.glite.version = HEAD
-
--#subsystem version tag = do not remove
-+#subsystem version tag = HEAD
- org.glite.slcs.version = HEAD
--org.glite.amga.version = glite-amga_R_1_0_0_2
-+org.glite.amga.version = HEAD
- org.glite.bdii.version = HEAD
--org.glite.ce.version = glite-ce_R_1_7_13_0
--org.glite.data.version = glite-data_R_3_1_17_1
--org.glite.dgas.version = glite-dgas_R_3_1_9_1
--org.glite.gpbox.version = glite-gpbox_R_1_3_0
-+org.glite.ce.version = HEAD
-+org.glite.data.version = HEAD
-+org.glite.dgas.version = HEAD
-+org.glite.gpbox.version = HEAD
- org.glite.info.version = HEAD
--org.glite.jdl.version = glite-jdl_R_3_1_11_1
--org.glite.jp.version = glite-jp_R_1_3_5_1
--org.glite.lb.version = glite-lb_R_1_4_1_1
-+org.glite.jdl.version = HEAD
-+org.glite.jp.version = HEAD
-+org.glite.lb.version = HEAD
- org.glite.overlay.version = HEAD
--org.glite.rgma.version = glite-rgma_R_5_0_66_1
--org.glite.security.version = glite-security_R_3_1_35_1
--org.glite.service-discovery.version = glite-service-discovery_R_2_0_14
--org.glite.templates-latex-style.version = glite-templates-latex-style_R_1_0_1
--org.glite.wms-ui.version = glite-wms-ui_R_3_1_17_1
--org.glite.wms-utils.version = glite-wms-utils_R_3_1_8
--org.glite.wms.version = glite-wms_R_3_1_56_1
-+org.glite.rgma.version = HEAD
-+org.glite.security.version = HEAD
-+org.glite.service-discovery.version = HEAD
-+org.glite.templates-latex-style.version = HEAD
-+org.glite.wms-ui.version = HEAD
-+org.glite.wms-utils.version = HEAD
-+org.glite.wms.version = HEAD
-
--org.gridsite.core.version = gridsite-core_R_1_1_18_1
-+org.gridsite.core.version = HEAD
- org.gridsite.ws.version = HEAD
-
-Index: org.glite.deployment/build.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/build.xml,v
-retrieving revision 1.62
-diff -u -r1.62 build.xml
---- org.glite.deployment/build.xml 22 Aug 2005 17:00:02 -0000 1.62
-+++ org.glite.deployment/build.xml 24 Apr 2007 08:20:35 -0000
-@@ -814,6 +814,39 @@
- </if>
- </target>
-
-+ <target name="jpps" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpps" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpps"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
-+
-+ <target name="jpis" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpis" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpis"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
- <target name="io-server" unless="setenvonly" depends="envset,config">
- <if>
- <isset property="small.memory"/>
-@@ -891,6 +924,8 @@
- wn,
- wms,
- lb,
-+ jpps,
-+ jpis,
- io-server,
- io-client,
- ce,
-Index: org.glite.deployment/project/dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/dependencies.properties,v
-retrieving revision 1.529
-diff -u -r1.529 dependencies.properties
---- org.glite.deployment/project/dependencies.properties 21 Jun 2006 09:29:08 -0000 1.529
-+++ org.glite.deployment/project/dependencies.properties 24 Apr 2007 08:20:35 -0000
-@@ -33,6 +33,8 @@
- org.glite.deployment.wn.version = HEAD
- org.glite.deployment.wms.version = HEAD
- org.glite.deployment.lb.version = HEAD
-+org.glite.deployment.jpps.version = HEAD
-+org.glite.deployment.jpis.version = HEAD
- org.glite.deployment.io-server.version = HEAD
- org.glite.deployment.io-client.version = HEAD
- org.glite.deployment.ce.version = HEAD
-Index: org.glite.deployment/project/glite.deployment.csf.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/glite.deployment.csf.xml,v
-retrieving revision 1.46
-diff -u -r1.46 glite.deployment.csf.xml
---- org.glite.deployment/project/glite.deployment.csf.xml 31 Jul 2006 09:53:53 -0000 1.46
-+++ org.glite.deployment/project/glite.deployment.csf.xml 24 Apr 2007 08:20:35 -0000
-@@ -392,6 +392,14 @@
- <equals arg1="${org.glite.deployment.lb.version}" arg2="HEAD" />
- </condition>
-
-+ <condition property="jpps.head">
-+ <equals arg1="${org.glite.deployment.jpps.version}" arg2="HEAD" />
-+ </condition>
-+
-+ <condition property="jpis.head">
-+ <equals arg1="${org.glite.deployment.jpis.version}" arg2="HEAD" />
-+ </condition>
-+
- <condition property="io-server.head">
- <equals arg1="${org.glite.deployment.io-server.version}" arg2="HEAD" />
- </condition>
-@@ -835,6 +843,28 @@
- tag="${org.glite.deployment.lb.version}" />
- </target>
-
-+ <!-- jpps component -->
-+ <target name="jpps" depends="get.jpps.head, get.jpps.tag"/>
-+ <target name="get.jpps.head" if="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps" />
-+ </target>
-+
-+ <target name="get.jpps.tag" unless="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps"
-+ tag="${org.glite.deployment.jpps.version}" />
-+ </target>
-+
-+ <!-- jpis component -->
-+ <target name="jpis" depends="get.jpis.head, get.jpis.tag"/>
-+ <target name="get.jpis.head" if="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis" />
-+ </target>
-+
-+ <target name="get.jpis.tag" unless="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis"
-+ tag="${org.glite.deployment.jpis.version}" />
-+ </target>
-+
- <!-- io-server component -->
- <target name="io-server" depends="get.io-server.head, get.io-server.tag"/>
- <target name="get.io-server.head" if="io-server.head">
-@@ -892,6 +922,8 @@
- wn,
- wms,
- lb,
-+ jpis,
-+ jpps,
- io-server,
- io-client,
- ce" />
-Index: org.glite.deployment.lb/config/scripts/glite-lb-config.py
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/scripts/glite-lb-config.py,v
-retrieving revision 1.66
-diff -u -r1.66 glite-lb-config.py
---- org.glite.deployment.lb/config/scripts/glite-lb-config.py 13 Mar 2006 15:22:31 -0000 1.66
-+++ org.glite.deployment.lb/config/scripts/glite-lb-config.py 24 Apr 2007 08:20:35 -0000
-@@ -121,6 +121,10 @@
- if not os.path.exists('/tmp/mysql.sock'):
- os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
-
-+ #-------------------------------------------------------------------
-+ # start bkserver
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if pid != 0:
- print 'The gLite LB Server service is already running. Restarting...'
-@@ -133,7 +137,7 @@
- pid = glib.getPID('bkserverd')
-
- if (pid != 0):
-- print "The gLite LB Server service has been started ",
-+ print "The gLite LB Server service has been started ",
- glib.printOkMessage()
- else:
- glib.printErrorMessage("Could not start the gLite LB Server service")
-@@ -142,6 +146,36 @@
- return 1
-
- #-------------------------------------------------------------------
-+ # start jp-importer, if enabled
-+ #-------------------------------------------------------------------
-+
-+ lb_import = 0
-+ if params.has_key('lb.import.enabled'):
-+ if params['lb.import.enabled'] == "true":
-+ lb_import = 1
-+
-+ if lb_import:
-+ pid = glib.getPID('jp-importer')
-+ if pid != 0:
-+ print 'The gLite JP Importer service is already running. Restarting...'
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+ else:
-+ print 'Starting the gLite JP Importer service...'
-+
-+ os.system('%s/etc/init.d/glite-jp-importer start' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+
-+ if (pid != 0):
-+ print "The gLite JP Importer service has been started ",
-+ glib.printOkMessage()
-+ else:
-+ glib.printErrorMessage("Could not start the gLite JP Importer service")
-+ glib.printErrorMessage("Please verify and re-run the script "),
-+ glib.printFailedMessage()
-+ return 1
-+
-+ #-------------------------------------------------------------------
- # Start Servicetool
- #-------------------------------------------------------------------
-
-@@ -161,6 +195,10 @@
- if (pid != 0):
- os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION'])
-
-+ #-------------------------------------------------------------------
-+ # Book Keeping Server
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if (pid != 0):
- print 'Could not stop the LB Server service ',
-@@ -171,6 +209,25 @@
- glib.printOkMessage()
-
- #-------------------------------------------------------------------
-+ # JP Importer
-+ #-------------------------------------------------------------------
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ print 'Could not stop the JP Importer service ',
-+ glib.printFailedMessage()
-+ error_level = 1
-+ else:
-+ if params.has_key('lb.import.enabled'):
-+ if params['lb.import.enabled'] == "true":
-+ print 'The JP Importer service has been stopped ',
-+ glib.printOkMessage()
-+
-+ #-------------------------------------------------------------------
- # MySQL
- #-------------------------------------------------------------------
-
-@@ -195,6 +252,10 @@
- if retval != 0:
- error_level = 1
-
-+ retval = os.system('%s/etc/init.d/glite-jp-importer status' % os.environ['GLITE_LOCATION'])
-+ if retval != 0:
-+ error_level = 1
-+
- #-------------------------------------------------------------------
- # Servicetool
- #-------------------------------------------------------------------
-@@ -325,7 +386,29 @@
- print "\n==> MySQL database %s already exist\n" % params['lb.database.name']
-
- self.mysql.stop()
--
-+
-+ # ------------------------------------------------------------------
-+ # export from bkserver to cron
-+ # ------------------------------------------------------------------
-+ if (params['GLITE_LB_PURGE_ENABLED'] == "true") or (params['GLITE_LB_EXPORT_ENABLED'] == "true"):
-+ file = open('%s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'], 'w')
-+ file.write('#! /bin/sh\n')
-+ file.write('. %s\n' % glib.getInstallerExportFile())
-+ file.write('$GLITE_LOCATION/sbin/glite-lb-export.sh\n')
-+ file.close()
-+ os.system('/bin/chmod 0755 %s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'])
-+
-+ file = open('/etc/cron.d/glite-lb-export.cron', 'w')
-+ file.write('# periodically run purge and export jobs from bkserver\n')
-+ file.write('00,30 * * * * %s %s/etc/glite-lb-export-cron-wrapper.sh 1>/dev/null\n' % (params['glite.user.name'], os.environ['GLITE_LOCATION']))
-+ file.close()
-+ os.system('/bin/chmod 0644 /etc/cron.d/glite-lb-export.cron')
-+ else:
-+ os.system('/bin/rm -f /etc/cron.d/glite-lb-export.cron')
-+
-+ # Touch cron spool directory to cause reloading of the crontabs
-+ os.system("/bin/touch /var/spool/cron")
-+
- #-------------------------------------------------------------------
- # RGMA servicetool: configure servicetool
- #-------------------------------------------------------------------
-@@ -411,6 +494,21 @@
- # Perl
- glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION']))
-
-+ # LB export
-+ glib.export('GLITE_LB_PURGE_ENABLED', params['lb.purge.enabled']);
-+ glib.export('GLITE_LB_EXPORT_ENABLED', params['lb.export.enabled']);
-+ glib.export('GLITE_LB_IMPORT_ENABLED', params['lb.import.enabled']);
-+ glib.export('GLITE_LB_EXPORT_JPPS', params['lb.export.jpps']);
-+ glib.export('GLITE_LB_EXPORT_JPREG_MAILDIR', params['lb.export.jpreg']);
-+ glib.export('GLITE_LB_EXPORT_JPDUMP_MAILDIR', params['lb.export.jpdump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR', params['lb.export.dump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR_KEEP', params['lb.export.dump.keep']);
-+ glib.export('GLITE_LB_EXPORT_JOBSDIR', params['lb.export.jobs']);
-+ glib.export('GLITE_LB_EXPORT_JOBSDIR_KEEP', params['lb.export.jobs.keep']);
-+ glib.export('GLITE_LB_EXPORT_PURGEDIR', params['lb.export.purge']);
-+ glib.export('GLITE_LB_EXPORT_PURGEDIR_KEEP', params['lb.export.purge.keep']);
-+ glib.export('GLITE_LB_EXPORT_PURGE_ARGS', '%s' % params['lb.export.purgeargs']);
-+
- # Set environment
- glib.setUserEnv()
-
-Index: org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml,v
-retrieving revision 1.21
-diff -u -r1.21 glite-lb.cfg.xml
---- org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 13 Mar 2006 15:19:21 -0000 1.21
-+++ org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 24 Apr 2007 08:20:35 -0000
-@@ -17,9 +17,16 @@
- parameter. Leave it empty of comment it out to use the same as 'glite.user.name'"
- value="changeme"/>
-
-- <mysql.root.password
-- description="The mysql root password"
-- value="changeme"/>
-+ <mysql.root.password
-+ description="The mysql root password"
-+ value="changeme"/>
-+
-+ <lb.export.jpps
-+ description="Job Provenance Primary Storage.
-+ [Example: localhost:8901][Type: string]"
-+ value="changeme"/>
-+
-+
-
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- Advanced parameters - Change them if you know what you're doing -->
-@@ -55,6 +62,28 @@
- [Example: 17M][Type: Integer][Unit: MB]"
- value="17M"/>
-
-+ <lb.purge.enabled
-+ description="Enables regular purge of LB database.
-+ Data are stored in lb.export.purge directory (specify below)
-+ [Example: true][Type: boolean]"
-+ value="true"/>
-+
-+ <lb.export.enabled
-+ description="Enables processing of purged data into lb.export.jpdump
-+ maildir directories (specify below) and export of job registrations
-+ from LB to lb.export.jpreg maildir directories (specify below).
-+ [Example: true][Type: boolean]"
-+ value="true"/>
-+
-+ <lb.import.enabled
-+ description="Enables import of data stored in maildirs to Job Provenance.
-+ lb.export.enabled must be set to true, to take any real effect.
-+ [Example: true][Type: boolean]"
-+ value="true"/>
-+
-+
-+
-+
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- System parameters - You should leave these alone -->
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-@@ -67,7 +96,44 @@
- <value>destination</value>
-
- </lb.index.list>
--
-+
-+ <lb.export.jpreg
-+ description="Spool directory where job registration requests are stored before delivered to JPPS.
-+ [Type: string]"
-+ value="/tmp/jpreg"/>
-+
-+ <lb.export.jpdump
-+ description="Spool directory where dump upload requests are stored before delivered to JPPS.
-+ [Type: string]"
-+ value="/tmp/jpdump"/>
-+
-+ <lb.export.purge
-+ description="Temporary directory for dumps of purged jobs.
-+ [Type: string]"
-+ value="/tmp/purge"/>
-+
-+ <lb.export.purge.keep
-+ description="Directory for dumps of jobs that were already handled (sent to JPPS).
-+ If empty, processed dumps of purged jobs are deleted.
-+ [Type: string]"
-+ value=""/>
-+
-+ <lb.export.jobs
-+ description="Exported events in file per job form before delivered to JPPS.
-+ [Type: string]"
-+ value="/tmp/lb_export"/>
-+
-+ <lb.export.jobs.keep
-+ description="Keep the already handled exported events in file per job form.
-+ If empty, processed job files are deleted.
-+ [Type: string]"
-+ value=""/>
-+
-+ <lb.export.purgeargs
-+ description="Arguments for LB purge process (a job in a given terminal state will be exported from the LB after timeouts defined here). See also glite-lb-purge documentation.
-+ [Example: -c 1h -a 1h -n 1h -o 1d][Type: string]"
-+ value="--cleared 2d --aborted 2w --cancelled 2w --other 2m"/>
-+
- </parameters>
-
- </config>
-Index: org.glite.deployment.lb/project/glite-lb.sdf.xml.template
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/project/glite-lb.sdf.xml.template,v
-retrieving revision 1.38
-diff -u -r1.38 glite-lb.sdf.xml.template
---- org.glite.deployment.lb/project/glite-lb.sdf.xml.template 13 Mar 2006 15:19:21 -0000 1.38
-+++ org.glite.deployment.lb/project/glite-lb.sdf.xml.template 24 Apr 2007 08:20:35 -0000
-@@ -15,7 +15,7 @@
- build="@org.glite.deployment.config.info.build@"
- arch="noarch"/>
-
-- <component name="glite-LB"
-+ <component name="glite-lb-config"
- version="@module.version@"
- age="@module.age@"
- build="@module.build@"
-@@ -57,6 +57,12 @@
- build="@org.glite.lb.server-bones.info.build@"
- arch="i386"/>
-
-+ <component name="glite-lb-client"
-+ version="@org.glite.lb.client.info.version@"
-+ age="@org.glite.lb.client.info.age@"
-+ build="@org.glite.lb.client.info.build@"
-+ arch="i386"/>
-+
- <component name="glite-wms-utils-jobid"
- version="@org.glite.wms-utils.jobid.info.version@"
- age="@org.glite.wms-utils.jobid.info.age@"
-@@ -105,6 +111,12 @@
- build="@org.glite.jp.ws-interface.info.build@"
- arch="i386"/>
-
-+ <component name="glite-jp-client"
-+ version="@org.glite.jp.client.info.version@"
-+ age="@org.glite.jp.client.info.age@"
-+ build="@org.glite.jp.client.info.build@"
-+ arch="i386"/>
-+
- <component name="gridsite"
- version="@org.gridsite.core.info.version@"
- age="@org.gridsite.core.info.age@"
-Index: org.glite.deployment.lb/project/properties.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/project/properties.xml,v
-retrieving revision 1.3
-diff -u -r1.3 properties.xml
---- org.glite.deployment.lb/project/properties.xml 13 Mar 2006 15:19:21 -0000 1.3
-+++ org.glite.deployment.lb/project/properties.xml 24 Apr 2007 08:20:35 -0000
-@@ -62,15 +62,15 @@
- Define extra properties here ...
- ====================================================== -->
-
-- <property name="build.package.name" value="glite-LB"/>
-+ <property name="build.package.name" value="glite-lb-config"/>
- <property name="build.package.summary" value="gLite Logging and Bookkeeping node configuration files" />
- <property name="build.package.description" value="gLite Logging and Bookkeeping node configuration files" />
- <property name="build.package.files" value="
- %attr(755,root,root) %{prefix}/etc/config/scripts/glite-lb-config.py\n
- %attr(600,root,root) %{prefix}/etc/config/templates/glite-lb.cfg.xml\n
--%attr(644,root,root) %{prefix}/share/doc/glite-LB/release_notes/release_notes.doc\n
--%attr(644,root,root) %{prefix}/share/doc/glite-LB/release_notes/release_notes.pdf\n
--%attr(644,root,root) %{prefix}/share/doc/glite-LB/release_notes/release_notes.html\n"/>
-+%attr(644,root,root) %{prefix}/share/doc/glite-lb/release_notes/release_notes.doc\n
-+%attr(644,root,root) %{prefix}/share/doc/glite-lb/release_notes/release_notes.pdf\n
-+%attr(644,root,root) %{prefix}/share/doc/glite-lb/release_notes/release_notes.html\n"/>
- <property name="build.package.obsolete" value="glite-lb-config"/>
-
- </project>
+++ /dev/null
-This patch was merged to deploy_all.diff, don't use it anymore
-
-Index: org.glite/project/global.dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite/project/global.dependencies.properties,v
-retrieving revision 1.479.2.70.2.3.2.3.2.1
-diff -u -r1.479.2.70.2.3.2.3.2.1 global.dependencies.properties
---- org.glite/project/global.dependencies.properties 9 May 2006 16:17:50 -0000 1.479.2.70.2.3.2.3.2.1
-+++ org.glite/project/global.dependencies.properties 30 Jun 2006 11:13:49 -0000
-@@ -15,7 +15,7 @@
- # Authors: Joachim Flammer <joachim.flammer@cern.ch>
- #
- # Version info: $Id$
--# Release: $Name$
-+# Release: $Name$
- #
- # Revision history:
- # $Log$
- # Revision 1.3 2006/06/30 11:30:28 mmulac
- # actualized patches
- # - against org.glite a org.glite.deployment from glite_R_3_0_0
- #
-@@ -1562,7 +1562,26 @@
- ext.globus-sdk.rpm.name = vdt_globus_sdk
- ext.globus-sdk.rpm.version = ${ext.vdt.version}
- ext.globus-sdk.rpm.age = 1
--
-+
-+# Globus vdt data server - grid ftp server
-+ext.globus-data-server.name = ${ext.globus.name}
-+ext.globus-data-server.vendor = ${ext.globus.vendor}
-+ext.globus-data-server.version = ${ext.globus.version}
-+ext.globus-data-server.platform = ${platform}
-+ext.globus-data-server.subdir = ${ext.globus-data-server.name}/${ext.globus-data-server.version}/${ext.globus-data-server.platform}
-+ext.globus-data-server.rep.base = ${jra1.rep.base}
-+ext.globus-data-server.rep.file =
-+ext.globus-data-server.rep.subdir =
-+ext.globus-data-server.rep.url = ${ext.globus-data-server.rep.base}/${ext.globus-data-server.subdir}/${ext.globus-data-server.rep.subdir}/${ext.globus-data-server.rep.file}
-+ext.globus-data-server.files =
-+ext.globus-data-server.download = http://www.cs.wisc.edu/vdt/releases/1.2.2/installing-rpms.html
-+ext.globus-data-server.homepage = http://www.cs.wisc.edu/vdt//index.html
-+ext.globus-data-server.description = The Globus Toolkit(R). This is the version packaged by VDT.
-+ext.globus-data-server.rpm.name = vdt_globus_data_server
-+ext.globus-data-server.rpm.version = ${ext.vdt.version}
-+ext.globus-data-server.rpm.age = 1
-+
-+
- # GPT
- ext.gpt.name = gpt
- ext.gpt.vendor = gpt
-@@ -3266,8 +3285,9 @@
- org.glite.dgas.version = glite-dgas_R_1_1_16
- org.glite.gpbox.version = glite-gpbox_R_1_0_15
- org.glite.jdl.version = glite-jdl_R_1_0_0
--org.glite.jp.version = glite-jp_R_1_1_3
--org.glite.lb.version = glite-lb_R_1_2_9
-+org.glite.jp.version = glite-jp_R_1_3_0
-+org.glite.lb.version = glite-lb_R_1_2_11
-+
- org.glite.rgma.version = glite-rgma_R_5_0_26
- org.glite.security.version = glite-security_R_3_0_15
- org.glite.service-discovery.version = glite-service-discovery_R_2_0_12
-Index: org.glite.deployment/build.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/build.xml,v
-retrieving revision 1.61.2.2.2.12.2.26
-diff -u -r1.61.2.2.2.12.2.26 build.xml
---- org.glite.deployment/build.xml 24 Apr 2006 13:39:27 -0000 1.61.2.2.2.12.2.26
-+++ org.glite.deployment/build.xml 30 Jun 2006 11:13:49 -0000
-@@ -9,7 +9,7 @@
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
-
-- Release: $Name$
-+ Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2006/06/30 11:30:28 mmulac
- actualized patches
- - against org.glite a org.glite.deployment from glite_R_3_0_0
-
-@@ -1619,6 +1619,39 @@
- </if>
- </target>
-
-+ <target name="jpps" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpps" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpps"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
-+
-+ <target name="jpis" unless="setenvonly" depends="envset,config">
-+ <if>
-+ <isset property="small.memory"/>
-+ <then>
-+ <exec dir="${deployment.subsystem.dir}.jpis" executable="${antExec}" failonerror="${failonerror}">
-+ <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}" "-Dbuild.name=${build.name}""/>
-+ </exec>
-+ </then>
-+ <else>
-+ <ant dir="${deployment.subsystem.dir}.jpis"
-+ target="${target}"
-+ inheritall="false" />
-+ </else>
-+ </if>
-+ </target>
-+
- <target name="io-server" unless="setenvonly" depends="envset,config">
- <if>
- <isset property="small.memory"/>
-@@ -1730,6 +1763,8 @@
- wn,
- wms,
- lb,
-+ jpps,
-+ jpis,
- io-server,
- io-client,
- ce,
-Index: org.glite.deployment/project/dependencies.properties
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/dependencies.properties,v
-retrieving revision 1.526.2.5.2.127.2.415.2.22
-diff -u -r1.526.2.5.2.127.2.415.2.22 dependencies.properties
---- org.glite.deployment/project/dependencies.properties 9 May 2006 12:33:18 -0000 1.526.2.5.2.127.2.415.2.22
-+++ org.glite.deployment/project/dependencies.properties 30 Jun 2006 11:13:49 -0000
-@@ -80,6 +80,10 @@
-
- org.glite.deployment.lb.version = glite-deployment-lb_R_2_2_3
-
-+ org.glite.deployment.jpis.version = HEAD
-+
-+ org.glite.deployment.jpps.version = HEAD
-+
- org.glite.deployment.glite-WMSLB.version = glite-deployment-glite-WMSLB_R_2_4_2
-
- org.glite.deployment.wn.version = glite-deployment-wn_R_2_3_7
-Index: org.glite.deployment/project/glite.deployment.csf.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment/project/glite.deployment.csf.xml,v
-retrieving revision 1.44.2.1.2.11.2.24
-diff -u -r1.44.2.1.2.11.2.24 glite.deployment.csf.xml
---- org.glite.deployment/project/glite.deployment.csf.xml 18 Apr 2006 15:42:14 -0000 1.44.2.1.2.11.2.24
-+++ org.glite.deployment/project/glite.deployment.csf.xml 30 Jun 2006 11:13:50 -0000
-@@ -9,7 +9,7 @@
- Authors: Joachim Flammer <Joachim.Flammer@cern.ch>
-
- Version info: $Id$
-- Release: $Name$
-+ Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2006/06/30 11:30:28 mmulac
- actualized patches
- - against org.glite a org.glite.deployment from glite_R_3_0_0
-
-@@ -667,6 +667,14 @@
- <equals arg1="${org.glite.deployment.lb.version}" arg2="HEAD" />
- </condition>
-
-+ <condition property="jpps.head">
-+ <equals arg1="${org.glite.deployment.jpps.version}" arg2="HEAD" />
-+ </condition>
-+
-+ <condition property="jpis.head">
-+ <equals arg1="${org.glite.deployment.jpis.version}" arg2="HEAD" />
-+ </condition>
-+
- <condition property="io-server.head">
- <equals arg1="${org.glite.deployment.io-server.version}" arg2="HEAD" />
- </condition>
-@@ -1571,6 +1579,28 @@
- tag="${org.glite.deployment.lb.version}" />
- </target>
-
-+ <!-- jpps component -->
-+ <target name="jpps" depends="get.jpps.head, get.jpps.tag"/>
-+ <target name="get.jpps.head" if="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps" />
-+ </target>
-+
-+ <target name="get.jpps.tag" unless="jpps.head">
-+ <cvs-co package="org.glite.deployment.jpps"
-+ tag="${org.glite.deployment.jpps.version}" />
-+ </target>
-+
-+ <!-- jpis component -->
-+ <target name="jpis" depends="get.jpis.head, get.jpis.tag"/>
-+ <target name="get.jpis.head" if="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis" />
-+ </target>
-+
-+ <target name="get.jpis.tag" unless="jpis.head">
-+ <cvs-co package="org.glite.deployment.jpis"
-+ tag="${org.glite.deployment.jpis.version}" />
-+ </target>
-+
- <!-- io-server component -->
- <target name="io-server" depends="get.io-server.head, get.io-server.tag"/>
- <target name="get.io-server.head" if="io-server.head">
-@@ -1667,6 +1697,8 @@
- wn,
- wms,
- lb,
-+ jpis,
-+ jpps,
- io-server,
- io-client,
- ce" />
+++ /dev/null
-This patch was merged to deploy_all.diff, don't use it anymore.
-
-Index: org.glite.deployment.lb/config/scripts/glite-lb-config.py
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/scripts/glite-lb-config.py,v
-retrieving revision 1.65.2.3
-diff -u -r1.65.2.3 glite-lb-config.py
---- org.glite.deployment.lb/config/scripts/glite-lb-config.py 2 May 2006 10:36:16 -0000 1.65.2.3
-+++ org.glite.deployment.lb/config/scripts/glite-lb-config.py 30 Jun 2006 09:29:21 -0000
-@@ -127,7 +127,12 @@
-
- if not os.path.exists('/tmp/mysql.sock'):
- os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
--
-+
-+
-+ #-------------------------------------------------------------------
-+ # start bkserver
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if pid != 0:
- print 'The gLite LB Server service is already running. Restarting...'
-@@ -140,7 +145,7 @@
- pid = glib.getPID('bkserverd')
-
- if (pid != 0):
-- print "The gLite LB Server service has been started ",
-+ print "The gLite LB Server service has been started ",
- glib.printOkMessage()
- else:
- glib.printErrorMessage("Could not start the gLite LB Server service")
-@@ -149,6 +154,36 @@
- return 1
-
- #-------------------------------------------------------------------
-+ # start jp-importer, if enabled
-+ #-------------------------------------------------------------------
-+
-+ lb_export = 0
-+ if params.has_key('lb.export.enabled'):
-+ if params['lb.export.enabled'] == "true":
-+ lb_export = 1
-+
-+ if lb_export:
-+ pid = glib.getPID('jp-importer')
-+ if pid != 0:
-+ print 'The gLite JP Importer service is already running. Restarting...'
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+ else:
-+ print 'Starting the gLite JP Importer service...'
-+
-+ os.system('%s/etc/init.d/glite-jp-importer start' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+
-+ if (pid != 0):
-+ print "The gLite JP Importer service has been started ",
-+ glib.printOkMessage()
-+ else:
-+ glib.printErrorMessage("Could not start the gLite JP Importer service")
-+ glib.printErrorMessage("Please verify and re-run the script "),
-+ glib.printFailedMessage()
-+ return 1
-+
-+ #-------------------------------------------------------------------
- # Start Servicetool
- #-------------------------------------------------------------------
-
-@@ -168,6 +203,10 @@
- if (pid != 0):
- os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION'])
-
-+ #-------------------------------------------------------------------
-+ # Book Keeping Server
-+ #-------------------------------------------------------------------
-+
- pid = glib.getPID('bkserverd')
- if (pid != 0):
- print 'Could not stop the LB Server service ',
-@@ -178,6 +217,25 @@
- glib.printOkMessage()
-
- #-------------------------------------------------------------------
-+ # JP Importer
-+ #-------------------------------------------------------------------
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ os.system('%s/etc/init.d/glite-jp-importer stop' % os.environ['GLITE_LOCATION'])
-+
-+ pid = glib.getPID('jp-importer')
-+ if (pid != 0):
-+ print 'Could not stop the JP Importer service ',
-+ glib.printFailedMessage()
-+ error_level = 1
-+ else:
-+ if params.has_key('lb.export.enabled'):
-+ if params['lb.export.enabled'] == "true":
-+ print 'The JP Importer service has been stopped ',
-+ glib.printOkMessage()
-+
-+ #-------------------------------------------------------------------
- # MySQL
- #-------------------------------------------------------------------
-
-@@ -202,6 +260,10 @@
- if retval != 0:
- error_level = 1
-
-+ retval = os.system('%s/etc/init.d/glite-jp-importer status' % os.environ['GLITE_LOCATION'])
-+ if retval != 0:
-+ error_level = 1
-+
- #-------------------------------------------------------------------
- # Servicetool
- #-------------------------------------------------------------------
-@@ -332,7 +394,27 @@
- print "\n==> MySQL database %s already exist\n" % params['lb.database.name']
-
- self.mysql.stop()
--
-+
-+ # ------------------------------------------------------------------
-+ # export from bkserver to cron
-+ # ------------------------------------------------------------------
-+ if params['GLITE_LB_EXPORT_ENABLED'] == "true":
-+ file = open('%s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'], 'w')
-+ file.write('#! /bin/sh\n')
-+ file.write('. %s\n' % glib.getInstallerExportFile())
-+ file.write('$GLITE_LOCATION/examples/glite-lb-export.sh\n')
-+ file.close()
-+ os.system('/bin/chmod 0755 %s/etc/glite-lb-export-cron-wrapper.sh' % os.environ['GLITE_LOCATION'])
-+
-+ file = open('/etc/cron.d/glite-lb-export.cron', 'w')
-+ file.write('# periodically run purge and export jobs from bkserver\n')
-+ file.write('00,30 * * * * %s %s/etc/glite-lb-export-cron-wrapper.sh\n' % (params['glite.user.name'], os.environ['GLITE_LOCATION']))
-+ file.close()
-+ os.system('/bin/chmod 0755 /etc/cron.d/glite-lb-export.cron')
-+
-+ # Touch cron spool directory to cause reloading of the crontabs
-+ os.system("/bin/touch /var/spool/cron")
-+
- #-------------------------------------------------------------------
- # RGMA servicetool: configure servicetool
- #-------------------------------------------------------------------
-@@ -418,6 +500,17 @@
- # Perl
- glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION']))
-
-+ # LB export
-+ glib.export('GLITE_LB_EXPORT_ENABLED', params['lb.export.enabled']);
-+ glib.export('GLITE_LB_EXPORT_BKSERVER', params['lb.export.bkserver']);
-+ glib.export('GLITE_LB_EXPORT_JPPS', params['lb.export.jpps']);
-+ glib.export('GLITE_LB_EXPORT_JPREG_MAILDIR', params['lb.export.jpreg']);
-+ glib.export('GLITE_LB_EXPORT_JPDUMP_MAILDIR', params['lb.export.jpdump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR', params['lb.export.dump']);
-+ glib.export('GLITE_LB_EXPORT_DUMPDIR_OLD', params['lb.export.dump.old']);
-+ glib.export('GLITE_LB_EXPORT_EXPORTDIR', params['lb.export.export']);
-+ glib.export('GLITE_LB_EXPORT_PURGE_ARGS', '"%s"' % params['lb.export.purgeargs']);
-+
- # Set environment
- glib.setUserEnv()
-
-Index: org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml,v
-retrieving revision 1.21
-diff -u -r1.21 glite-lb.cfg.xml
---- org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 13 Mar 2006 15:19:21 -0000 1.21
-+++ org.glite.deployment.lb/config/templates/glite-lb.cfg.xml 30 Jun 2006 09:29:21 -0000
-@@ -17,9 +17,16 @@
- parameter. Leave it empty of comment it out to use the same as 'glite.user.name'"
- value="changeme"/>
-
-- <mysql.root.password
-- description="The mysql root password"
-- value="changeme"/>
-+ <mysql.root.password
-+ description="The mysql root password"
-+ value="changeme"/>
-+
-+ <lb.export.jpps
-+ description="Job Provenance Primary Storage.
-+ [Example: localhost:8901][Type: string]"
-+ value="changeme"/>
-+
-+
-
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- Advanced parameters - Change them if you know what you're doing -->
-@@ -55,6 +62,12 @@
- [Example: 17M][Type: Integer][Unit: MB]"
- value="17M"/>
-
-+ <lb.export.enabled
-+ description="Enables exports to Job Provenance.
-+ [Example: true][Type: boolean]"
-+ value="true"/>
-+
-+
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- System parameters - You should leave these alone -->
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-@@ -67,7 +80,42 @@
- <value>destination</value>
-
- </lb.index.list>
--
-+
-+ <lb.export.bkserver
-+ description="Book Keeping Server service when differs from default port on localhost.
-+ [Example: localhost:9000][Type: string]"
-+ value=""/>
-+
-+ <lb.export.jpreg
-+ description="Maildir for job registrations.
-+ [Example: /tmp/jpreg][Type: string]"
-+ value=""/>
-+
-+ <lb.export.jpdump
-+ description="Maildir for job dumps.
-+ [Example: /tmp/jpdump][Type: string]"
-+ value=""/>
-+
-+ <lb.export.dump
-+ description="Dump directory for purged jobs.
-+ [Example: /tmp/dump][Type: string]"
-+ value=""/>
-+
-+ <lb.export.dump.old
-+ description="Dump directory for handled purged jobs.
-+ [Example: /tmp/dump.old][Type: string]"
-+ value=""/>
-+
-+ <lb.export.export
-+ description="Exported events divided to file per job.
-+ [Example: /tmp/lb_export][Type: string]"
-+ value=""/>
-+
-+ <lb.export.purgeargs
-+ description="Purge arguments (with timeouts).
-+ [Example: -a 1h -c 1h -n 1h -o 1d][Type: string]"
-+ value="-a 1d -c 1d -n 1d -o 7d"/>
-+
- </parameters>
-
- </config>
-Index: org.glite.deployment.lb/project/glite-lb.sdf.xml.template
-===================================================================
-RCS file: /cvs/jra1mw/org.glite.deployment.lb/project/glite-lb.sdf.xml.template,v
-retrieving revision 1.38.2.2
-diff -u -r1.38.2.2 glite-lb.sdf.xml.template
---- org.glite.deployment.lb/project/glite-lb.sdf.xml.template 2 May 2006 10:36:19 -0000 1.38.2.2
-+++ org.glite.deployment.lb/project/glite-lb.sdf.xml.template 30 Jun 2006 09:29:21 -0000
-@@ -57,6 +57,12 @@
- build="@org.glite.lb.server-bones.info.build@"
- arch="i386"/>
-
-+ <component name="glite-lb-client"
-+ version="@org.glite.lb.client.info.version@"
-+ age="@org.glite.lb.client.info.age@"
-+ build="@org.glite.lb.client.info.build@"
-+ arch="i386"/>
-+
- <component name="glite-wms-utils-jobid"
- version="@org.glite.wms-utils.jobid.info.version@"
- age="@org.glite.wms-utils.jobid.info.age@"
-@@ -105,6 +111,12 @@
- build="@org.glite.jp.ws-interface.info.build@"
- arch="i386"/>
-
-+ <component name="glite-jp-client"
-+ version="@org.glite.jp.client.info.version@"
-+ age="@org.glite.jp.client.info.age@"
-+ build="@org.glite.jp.client.info.build@"
-+ arch="i386"/>
-+
- <component name="gridsite"
- version="@org.gridsite.core.info.version@"
- age="@org.gridsite.core.info.age@"
+++ /dev/null
-These are the instructions how to build LB for VDT:
-
-$ mkdir lb4vdt
-$ cd lb4vdt
-$ export CVSROOT=:pserver:anonymous@jra1mw.cvs.cern.ch:/cvs/jra1mw
-$ cvs co org.glite.lb
-
-you may need to edit ./org.glite.lb/lb4vdt/Makefile.inc
-to specify some paths (some of them should be set automaticaly,
-e.g. by VDT_LOCATION)
-
-and then (still from the top directory) run
-
-$ ./org.glite.lb/lb4vdt/LB_install.sh 2>&1 | tee log
-
-:)
+++ /dev/null
-CLPR=1; for jobid in `./stage/sbin/glite-lb-perftest_logjobs -m scientific.civ.zcu.cz:10000 -f stage/examples/perftest/perf_simple_avg_events.log -n 1000 -p /tmp/perftest_michal.log -s /tmp/proxy_michal.perf|grep https`; do stage/bin/glite-lb-logevent -x -S /tmp/proxy_michal.perfstore.sock -c $SEQCODE -j $jobid -s UserInterface -e Abort --reason Purge; done
+++ /dev/null
-./stage/sbin/glite-lb-purge -j /tmp/perftest_1000.jobids -m scientific.civ.zcu.cz:10000 -s
+++ /dev/null
- REG=1; for jobid in `./stage/sbin/glite-lb-perftest_logjobs -m scientific.civ.zcu.cz:10000 -f stage/examples/perftest/perf_simple_avg_events.log -n 1000 -p /tmp/perftest_michal.log -s /tmp/proxy_michal.perf|grep https`; do stage/examples/glite-lb-job_reg -j $jobid -s UserInterface ; done
+++ /dev/null
-./shared/egee/jra1-head/stage/sbin/perftest_il.sh 10
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 154727793 11240340 101479915 621678
-[jobs/day]
-b) 11540156 594389 10416164 402240
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 14323607 547755 10158371 375594
-[jobs/day]
-b) 6284230 364547 4554967 300055
-[jobs/day]
-c) 7540122 412971 3186381 300417
-[jobs/day]
-x) 9672327 418137 2567653 297477
-[jobs/day]
-d) this test is not yet implemented
-e) 9650719 410507 3651840 301687
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 2639788 182196 2035014 246654
-[jobs/day]
-b) 1170308 45973 759842 74898
-[jobs/day]
-c) 1060595 42047 921386 76638
-[jobs/day]
-x) 1091863 42247 518302 82129
-[jobs/day]
-d) this test is not yet implemented
-e) 1147040 41790 489257 76627
-[jobs/day]
-
+++ /dev/null
-[michal@scientific jra1-head]$ ./stage/sbin/perftest_il.sh 10
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 149765990 10933663 100162299 619924
-[jobs/day]
-b) 11857056 479615 2753618 277679
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 13813170 268900 6448242 244203
-[jobs/day]
-b) 4525621 255055 6147103 241153
-[jobs/day]
-c) 9338319 217855 5497442 248429
-[jobs/day]
-x) 9335090 232292 3989195 236341
-[jobs/day]
-d) this test is not yet implemented
-e) 3283323 216013 7284868 256479
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 4019651 44496 766972 95556
-[jobs/day]
-b) 1366885 47501 564779 90055
-[jobs/day]
-c) 1152594 47656 603774 97465
-[jobs/day]
-x) 1049069 48779 607913 88692
-[jobs/day]
-d) this test is not yet implemented
-e) 942509 46271 523129 91103
-[jobs/day]
-
-
-*************************************************************************
-
-
-[michal@scientific jra1-head]$ ./stage/sbin/perftest_il.sh 100
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 157966907 0 0 620546
-[jobs/day]
-b) 13833450 558487 10210340 283454
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 12884330 316703 4447489 151870
-[jobs/day]
-b) 7980713 469667 4641283 244463
-[jobs/day]
-c) 8458472 556919 5657712 253640
-[jobs/day]
-x) 8149836 549678 4765300 257375
-[jobs/day]
-d) this test is not yet implemented
-e) 9687868 503933 4461079 247092
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 9389344 97159 450483 68610
-[jobs/day]
-b) 1195400 82681 560118 88216
-[jobs/day]
-c) 1351879 88207 830072 102285
-[jobs/day]
-x) 1173835 85897 562648 0
-[jobs/day]
-d) this test is not yet implemented
-e) 1205291 78355 567658 87770
-[jobs/day]
+++ /dev/null
-[michal@scientific jra1-head]$ ./stage/sbin/perftest_il.sh 10
--------------------------------------------
-Logging test:
- - events sent through IPC and/or files
- - events discarded by IL immediately
--------------------------------------------
-a) events sent only by IPC
-b) events stored to files and sent by IPC
-
- small_job big_job small_dag big_dag
-a) 153599999 11157889 101479915 539075
-[jobs/day]
-b) 10835893 1059003 2577803 351095
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events discarded in IL
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 14148626 772362 11498383 376986
-[jobs/day]
-b) 5348851 489142 5558879 292071
-[jobs/day]
-c) 9042670 441000 5911613 287842
-[jobs/day]
-x) 7730298 414784 6579748 289834
-[jobs/day]
-d) this test is not applicable
-e) 9288325 365701 7189156 299604
-[jobs/day]
------------------------------------
-Interlogger test:
- - events sent through IPC & files
- - events consumed by empty BS
------------------------------------
-a) disabled event parsing, the server address (jobid) is hardcoded
-b) disabled event synchronization from files
-c) disabled recovery thread
-x) disabled sync and recovery
-d) lazy bkserver connection close
-e) normal operation
-
- small_job big_job small_dag big_dag
-a) 2219003 185867 1785164 258615
-[jobs/day]
-b) 1795503 48283 309380 77422
-[jobs/day]
-c) 1201618 39001 850436 74771
-[jobs/day]
-x) 1134249 48039 447017 74244
-[jobs/day]
-d) 5335078 207059 2438095 96295
-[jobs/day]
-e) 1019269 36465 875966 65565
-[jobs/day]
-
-
+++ /dev/null
-michal:~/shared/egee/jra1-head> ./stage/sbin/perftest_ll.sh 10
-----------------
-Locallogger test
-----------------
-a) glite-lb-logd-perf-nofile --noParse --noIPC
-b) glite-lb-logd-perf-nofile --noIPC
-c) glite-lb-logd-perf --noIPC
-d) glite-lb-logd-perf
-
-Number of jobs: 10
-
- small_job big_job small_dag big_dag
-a) 14.544066 14.590504 14.681760 9.264801 [events/sec]
- 125660 8404 97577 25821 [jobs/day]
-b) 14.614844 14.408043 14.279216 9.600877 [events/sec]
- 126272 8298 94901 26758 [jobs/day]
-c) 0.000000 0.000000 0.000000 0.000000 [events/sec]
- 0 0 0 0 [jobs/day]
-d) 13.331568 13.530218 13.420780 8.363152 [events/sec]
- 115184 7793 89196 23308 [jobs/day]
+++ /dev/null
--------------------
-LB chain test
--------------------
-- proxy & interlogger (lazy variant) running at umbar
-- bkserver running at sci
-- test variants:
- a) 10 jobs
- b) 100 jobs
- c) 1000 jobs
-
-
-Results:
-
- small_job big_job small_dag big_dag
----------------------------------------------------------------
-a) 3.0 x x x [mjobs/day]
-b) 1.0 x x x [mjobs/day]
-c) 0.6 x x x [mjobs/day]
-
-
+++ /dev/null
--------------------
-LB chain test
--------------------
-- proxy & interlogger (lazy variant) running at umbar
-- bkserver running at sci
-- test variants:
- a) 100 jobs, no background queries
- b) 1000 jobs, no background queries
- c) 10000 jobs, no background queries
- d) 100 jobs, 10 parallel queries
- e) 1000 jobs, 10 parallel queries, perf interlogger
- f) 1000 jobs, 10 parallel queries, normal interlogger
-- in d)-f) the server was queried by 10 independent clients for states
- of all jobs periodically with random sleep between queries (0-5sec)
-
-Results:
-
- small_job big_job small_dag big_dag
----------------------------------------------------------------
-a) 1.0 x x x [mjobs/day]
-b) 0.6 x x x [mjobs/day]
-c) 0.5 x x x [mjobs/day]
-d) 0.8 x x x [mjobs/day]
-e) 0.45 x x x [mjobs/day]
-f) 0.4 x x x [mjobs/day]
+++ /dev/null
-----------------------------------
-LB Proxy test
-----------------------------------
-Events are consumed:
-1) before parsing
-2) after parsing, before storing into database
-3) after storing into db, before computing state
-4) after computing state, before sending to IL
-5) by IL
-
- small_job big_job small_dag big_dag
-1) 43005186.489600 2852512.156800 31859581.824000 502823.721600
-[jobs/day]
-2) 37764713.548800 2438483.961600 26108871.523200 340065.648000
-[jobs/day]
-3) 1754530.243200 272980.540800 2051218.684800 0.000000
-[jobs/day]
-4) 1267110.000000 176052.182400 1506470.486400 0.000000
-[jobs/day]
-5) 329471.452800 48787.747200 318152.275200 0.000000
-[jobs/day]
+++ /dev/null
- ./stage/bin/glite-lb-interlogd -d -s /tmp/perftest_michal.sock --file-prefix=/tmp/perftest_michal.log --lazy
+++ /dev/null
-./stage/bin/glite-lb-proxy -d --silent -p /tmp/proxy_michal.perf --proxy-il-sock /tmp/perftest_michal.sock --proxy-il-fprefix /tmp/perftest_michal.log
+++ /dev/null
-./stage/bin/glite-lb-bkserverd -d --perf-sink=4 -p 10000 -w 10003 -S /tmp/purge_michal -D /tmp/dump_michal --silent
+++ /dev/null
-TEST=1; ./stage/sbin/glite-lb-perftest_logjobs -d proxy -m scientific.civ.zcu.cz:10000 -f stage/examples/perftest/perf_simple_avg_events.log -n 1000 -p /tmp/perftest_michal.log -s /tmp/proxy_michal.perf
+++ /dev/null
-#!/usr/bin/perl
-
-use Getopt::Std;
-use Switch;
-
-$TMPDIR=$ENV{'TMPDIR'};
-$GLITE_LB_LOCATION="./org.glite.lb";
-
-if ($TMPDIR eq "") {$TMPDIR="/tmp";}
-
-getopts('ch');
-
-$usage = qq{
-usage: $0 [-h] subsystem.name [subsystem.name] [...]
-
- This script checks the consistency of tags in CVS and version.properties
-
- -c also verify etics configurations
- -h Display this help
-
-};
-
- # **********************************
- # Interpret cmdline options
- # **********************************
-
- if (defined $opt_h) {die $usage};
- die $usage unless @ARGV[0];
-
- if (defined $opt_c) {
- printf ("\n\nYou have selected the -c option. Note that etics may require authetication.\n If you cannot see any progress in the script, it is probably waiting for your password. ;-)\n\n");
- }
-
- # **********************************
- # Iterate through subsystems
- # **********************************
-
- foreach $subsystem (@ARGV) {
-
- #Clean possible trailing '/' (even multiple occurrences :-) from subsystem name
- $subsystem=~s/\/+$//;
-
- printf("$subsystem\n");
-
- $subsystem=~/\.([^\.]+?)$/;
-
- @modules=split(/\s+/, `PATH=\$PATH:./:./org.glite.lb configure --listmodules $1`);
-
- unshift (@modules, $subsystem);
-
- foreach $module (@modules) {
-
- printf(" %-30s", $module);
-
-
- if (open VP, "$module/project/version.properties") {
-
- while ($_ = <VP>) {
- chomp;
-
- if(/module\.version\s*=\s*(\d*)\.(\d*)\.(\d*)/) {
- $current_major=$1;
- $current_minor=$2;
- $current_revision=$3;
- }
- if(/module\.age\s*=\s*(\S+)/) {
- $current_age=$1;
- }
- }
- close (VP);
-
- $current_prefix=$module;
- $current_prefix=~s/^org\.//;
- $current_prefix=~s/\./-/g;
- $current_prefix="$current_prefix" . "_R_";
- $current_tag="$current_prefix" . "$current_major" . "_$current_minor" . "_$current_revision" . "_$current_age";
-
- if ($module eq $subsystem) { $subsystem_tag = $current_tag; }
-
- printf("\t $current_major.$current_minor.$current_revision-$current_age");
-
- unless (system("cvs log -h $module/project/version.properties | grep -E \"\\W$current_tag\\W\" > /dev/null"))
- { printf ("\t mod. OK"); }
- else {
- printf(STDERR "\nERROR: Tag $current_tag does not exist in module $module!\n");
- }
-
- if ($module ne $subsystem ) {
- unless (system("cvs log -h $module/project/version.properties | grep -E \"\\W$subsystem_tag\\W\" > /dev/null"))
- { printf ("\t subsys. OK"); }
- else {
- printf(STDERR "\nERROR: Tag $subsystem_tag does not exist in module $module!\n");
- }
-
- unless (-e "$module/project/ChangeLog") {
- printf(STDERR "\nERROR: The ChangeLog file for module $module does not exist!\n");
- }
- }
-
- unless (-e "$module/configure") {
- printf(STDERR "\nERROR: The configure script for module $module does not exist!\n");
- }
-
- if (defined $opt_c) {
- unless (system("etics-list-configuration $module | grep \"$current_tag\" &> /dev/null"))
- { printf ("\t etics OK"); }
- else {
- printf(STDERR "\nERROR: Configuration $current_tag for module $module does not exist!\n");
- }
- }
-
- printf("\n");
-
- }
- else {
- printf(STDERR "\nERROR: The version.properties file for module $module does not exist!\n");
- }
- }
- }
-
+++ /dev/null
-#!/usr/bin/perl
-
-use Getopt::Std;
-use Switch;
-
-$TMPDIR=$ENV{'TMPDIR'};
-
-if ($TMPDIR eq "") {$TMPDIR="/tmp";}
-
-getopts('c:h');
-
-$module = shift;
-
-chomp($module);
-
-$usage = qq{
-usage: $0 [-c <current configuration>] module.name
-
- -c Use this configuration (\d+\.\d+\.\d+-\S+) rather than parsing version.properties
- -h Display this help
-
-};
- if (defined $opt_h) {die $usage};
- die $usage unless $module;
-
- #Clean possible trailing '/' (even multiple occurrences :-) from module name
- $module=~s/\/+$//;
-
- if (defined $opt_c) {
-
- # **********************************
- # Parse the tag supplied by the user
- # **********************************
-
- if ($opt_c=~/(\d+)\.(\d+)\.(\d+)-(\S+?)/) {
- $current_major=$1;
- $current_minor=$2;
- $current_revision=$3;
- $current_age=$4;
- }
- else {die ("tag not specified properly")};
-
- }
- else {
- # **********************************
- # Determine the most recent tag and its components
- # **********************************
-
- open VP, "$module/project/version.properties" or die "$module/project/version.properties: $?\n";
-
- while ($_ = <VP>) {
- chomp;
-
- if(/module\.version\s*=\s*(\d*)\.(\d*)\.(\d*)/) {
- $current_major=$1;
- $current_minor=$2;
- $current_revision=$3;
- }
- if(/module\.age\s*=\s*(\S+)/) {
- $current_age=$1;
- }
- }
- close (VP);
-
- $current_prefix=$module;
- $current_prefix=~s/^org\.//;
- $current_prefix=~s/\./-/g;
- $current_prefix="$current_prefix" . "_R_";
- $current_tag="$current_prefix" . "$current_major" . "_$current_minor" . "_$current_revision" . "_$current_age";
- }
-
- # According to the documentation, symbolic names in the 'cvs log' output are sorted by age so this should be OK
- #$current_tag=`cvs log -h $module/Makefile | grep \"_R_\" | head -n 1`;
- #$current_tag=~s/^\s//;
- #$current_tag=~s/:.*?$//;
- #chomp($current_tag);
-
- #$current_tag=~/(.*_R_)(\d*?)_(\d*?)_(\d*?)_(.*)/;
- #$current_prefix=$1;
- #$current_major=$2;
- #$current_minor=$3;
- #$current_revision=$4;
- #$current_age=$5;
-
- $module=~/\.([^\.]+?)$/;
-
- @modules=split(/\s+/, `PATH=\$PATH:./:./org.glite.lb configure --listmodules $1`);
-
- my $incmajor=0;
- my $incminor=0;
- my $increvision=0;
- my $incage=0;
-
-
- # **********************************
- # Iterate through modules and find out what has changed
- # **********************************
-
- foreach $m (@modules) {
- printf("\n***$m\n");
-
- $old_major=-1; $old_minor=-1; $old_revision=-1; $old_age=-1;
- $new_major=-1; $new_minor=-1; $new_revision=-1; $new_age=-1;
-
- foreach $l (`cvs diff -r $current_prefix$current_major\_$current_minor\_$current_revision\_$current_age $m/project/version.properties | grep -E "module\.age|module\.version"`) {
- chomp($l);
- printf("$l\n");
-
- if($l=~/<\s*module\.version\s*=\s*(\d*)\.(\d*)\.(\d*)/) {
- $old_major=$1;
- $old_minor=$2;
- $old_revision=$3;
- }
- elsif($l=~/<\s*module\.age\s*=\s*(\S+)/) {
- $old_age=$1;
- }
- elsif($l=~/>\s*module\.version\s*=\s*(\d*)\.(\d*)\.(\d*)/) {
- $new_major=$1;
- $new_minor=$2;
- $new_revision=$3;
- }
- elsif($l=~/>\s*module\.age\s*=\s*(\S+)/) {
- $new_age=$1;
- }
- }
-
-
-
- if ($old_major != $new_major) {
- $incmajor++;
- printf("Major change ($old_major -> $new_major)");
- }
- elsif ($old_minor != $new_minor) {
- $incminor++;
- printf("Minor change ($old_minor -> $new_minor)");
- }
- elsif ($old_revision != $new_revision) {
- $increvision++;
- printf("Revision change ($old_revision -> $new_revision)");
- }
- elsif ($old_age != $new_age) {
- $incage++;
- printf("Age change ($old_age -> $new_age)");
- }
- printf("\n");
-
- }
-
- printf("Current tag: $current_tag\n\tprefix: $current_prefix\n\t major: $current_major\n\t minor: $current_minor\n\t rev: $current_revision\n\t age: $current_age\n");
-
- # **********************************
- # Generate the new tag name
- # **********************************
-
- if($incmajor > 0) {
- $major=$current_major+1;
- $minor=0;
- $revision=0;
- $age=1;}
- elsif($incminor > 0) {
- $major=$current_major;
- $minor=$current_minor+1;
- $revision=0;
- $age=1;}
- elsif($increvision > 0) {
- $major=$current_major;
- $minor=$current_minor;
- $revision=$current_revision+1;
- $age=1;}
- elsif($incage > 0) {
- $major=$current_major;
- $minor=$current_minor;
- $revision=$current_revision;
- $age=$current_age+1;}
- else {
- printf("No change in either version component.\nAbort by pressing Ctrl+C or enter new age manually.\nUse a number or a word: ");
- $major=$current_major;
- $minor=$current_minor;
- $revision=$current_revision;
- $age=<STDIN>;}
-
- chomp($age);
-
- $tag="$current_prefix" . "$major" . "_$minor" . "_$revision" . "_$age";
-
- printf("\nNew tag: $tag\n\n");
-
- die "This tag already exists; reported by assertion" unless system("cvs log -h $module/Makefile | grep \"$tag\"");
-
- # **********************************
- # Create the execution script
- # **********************************
-
- open EXEC, ">", "$TMPDIR/tag-with-subsystems-$module.$major.$minor.$revision-$age.sh" or die $!;
-
- printf (EXEC "#This script registers tags for the $module module, version $major.$minor.$revision-$age\n#Generated automatically by $0\n\n");
-
-
- # **********************************
- # Update version.properties
- # **********************************
- open V, "$module/project/version.properties" or die "$module/project/version.properties: $?\n";
-
- printf(EXEC "#Generate new version.properties\ncat >$module/project/version.properties <<EOF\n");
- while ($_ = <V>) {
- chomp;
-
- $_=~s/module\.version\s*=\s*[.0-9]+/module\.version=$major.$minor.$revision/;
- $_=~s/module\.age\s*=\s*(\S+)/module\.age=$age/;
-
- printf(EXEC "$_\n");
- }
- close V;
- printf(EXEC "EOF\n\n");
- printf(EXEC "cvs commit -m \"Modified to reflect version $major.$minor.$revision-$age\" $module/project/version.properties\n\n");
-
-
- $cwd=`pwd`;
- chomp($cwd);
-
- printf(EXEC "#Register the new tag\ncd $module\ncvs tag \"$tag\"\n");
- foreach $m (@modules) {
- printf (EXEC "cd \"$cwd/$m\"\ncvs tag \"$tag\"\n");
- }
- printf(EXEC "cd \"$cwd\"\n");
-
-
-
- # **********************************
- # Etics configuration prepare / modify / upload
- # **********************************
-
-# $currentconfig="$module_$module" . "_R_$current_major" . "_$current_minor" . "_$current_revision" . "_$current_age";
-# $currentconfig=~s/^org.//;
-# $currentconfig=~s/\./-/g;
- $newconfig="$module_$module" . "_R_$major" . "_$minor" . "_$revision" . "_$age";
- $newconfig=~s/^org.//;
- $newconfig=~s/\./-/g;
-
-
- printf("\nNew configuration:\t$newconfig\n\nPreparing...\n");
-
- open NEWCONF, ">", "$TMPDIR/$newconfig.ini.$$" or die $!;
-
- printf (NEWCONF "[Configuration-$newconfig]\nprofile = None\nmoduleName = $module\ndisplayName = $newconfig\ndescription = None\nprojectName = org.glite\nage = $age\ntag = $tag\nversion = $major.$minor.$revision\npath = None\n\n");
-
-# printf (NEWCONF "[Platform-default:VcsCommand]\ndisplayName = None\ndescription = HEAD CVS commands\ntag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName}\nbranch = None\ncommit = None\ncheckout = cvs -d \${vcsroot} co -r \${tag} \${moduleName}\n\n");
-
-# printf (NEWCONF "[Platform-default:Environment]\nHOME = \${workspaceDir}");
-
- printf (NEWCONF "\n\n[Hierarchy]\n");
-
- foreach $m (@modules) {
- open MOD, "$m/project/version.properties" or die "$m/project/version.properties: $?\n";
-
- $m_major=0; $m_minor=0; $m_revision=0; $m_age=0;
-
- while ($_ = <MOD>) {
- chomp;
-
- if(/module\.version\s*=\s*(\d*)\.(\d*)\.(\d*)/) {
- $m_major=$1;
- $m_minor=$2;
- $m_revision=$3;
- }
- if(/module\.age\s*=\s*(\S+)/) {
- $m_age=$1;
- }
- }
-
- $modconfig="$m_$m" . "_R_$m_major" . "_$m_minor" . "_$m_revision" . "_$m_age";
- $modconfig=~s/^org.//;
- $modconfig=~s/\./-/g;
-
-# system("echo $m = $modconfig >> $TMPDIR/$newconfig.ini.$$");
- printf(NEWCONF "$m = $modconfig\n");
-
- close (MOD);
- }
-
- close(NEWCONF);
-
- printf(EXEC "\n#Add new configuration\netics-configuration add -i $TMPDIR/$newconfig.ini.$$ -c $newconfig $module\n");
- printf(EXEC "etics-commit\n");
-
-
- # **********************************
- # Final bows
- # **********************************
-
- close(EXEC);
-
- system("chmod +x \"$TMPDIR/tag-with-subsystems-$module.$major.$minor.$revision-$age.sh\"");
-
- printf("\n\n---------\nFinished!\n\nExecution script written in:\t$TMPDIR/tag-with-subsystems-$module.$major.$minor.$revision-$age.sh\nNew configuration written in:\t$TMPDIR/$newconfig.ini.$$\n\n");
-
+++ /dev/null
-#!/usr/bin/perl
-
-use Getopt::Std;
-use Switch;
-
-$TMPDIR=$ENV{'TMPDIR'};
-$GLITE_LB_LOCATION="./org.glite.lb";
-
-if ($TMPDIR eq "") {$TMPDIR="/tmp";}
-
-getopts('i:c:m:gh');
-
-$module = shift;
-
-$usage = qq{
-usage: $0 [-i maj|min|rev|age|none|<sigle_word_age>] [-g] [-c <current configuration> ] module.name
-
- -i What to increment ('maj'or version, 'min'or version, 'rev'ision, 'age')
- Should you fail to specify the -i option the script will open up a cvs diff
- output and ask you to specify what to increment interactively.
- 'none' means no change -- this basically just generates a configuration.
- -g Generate old configuration for comparison
- -c Use this configuration (\d+\.\d+\.\d+-\S+) rather than parsing version.properties
- -m Use this as a CVS commit message instead of the script's default.
- -h Display this help
-
-};
-
- # **********************************
- # Interpret cmdline options
- # **********************************
-
- if (defined $opt_h) {die $usage};
- die $usage unless $module;
-
- #Clean possible trailing '/' (even multiple occurrences :-) from module name
- $module=~s/\/+$//;
-
- switch ($opt_i) {
- case "maj" {$increment="j"}
- case "min" {$increment="i"}
- case "rev" {$increment="r"}
- case "age" {$increment="a"}
- case "none" {$increment="n"}
- else {$increment=$opt_i};
- }
-
-
- if (defined $opt_c) {
-
- # **********************************
- # Parse the tag supplied by the user
- # **********************************
-
- if ($opt_c=~/(\d+)\.(\d+)\.(\d+)-(\S+?)/) {
- $current_major=$1;
- $current_minor=$2;
- $current_revision=$3;
- $current_age=$4;
- }
- else {die ("tag not stated properly")};
-
- }
- else {
-
- # **********************************
- # Determine the most recent tag and its components from version.properties
- # **********************************
-
- open VP, "$module/project/version.properties" or die "$module/project/version.properties: $?\n";
-
- while ($_ = <VP>) {
- chomp;
-
- if(/module\.version\s*=\s*(\d*)\.(\d*)\.(\d*)/) {
- $current_major=$1;
- $current_minor=$2;
- $current_revision=$3;
- }
- if(/module\.age\s*=\s*(\S+)/) {
- $current_age=$1;
- }
- }
- close (VP);
-
- $current_prefix=$module;
- $current_prefix=~s/^org\.//;
- $current_prefix=~s/\./-/g;
- $current_prefix="$current_prefix" . "_R_";
- $current_tag="$current_prefix" . "$current_major" . "_$current_minor" . "_$current_revision" . "_$current_age";
- }
-
- # According to the documentation, symbolic names in the 'cvs log' output are sorted by age so this should be OK
- #$current_tag=`cvs log -h $module/Makefile | grep \"_R_\" | head -n 1`;
- #$current_tag=~s/^\s//;
- #$current_tag=~s/:.*?$//;
- #chomp($current_tag);
-
- #$current_tag=~/(.*_R_)(\d*?)_(\d*?)_(\d*?)_(.*)/;
- #$current_prefix=$1;
- #$current_major=$2;
- #$current_minor=$3;
- #$current_revision=$4;
- #$current_age=$5;
-
- printf("Current tag: $current_tag\n\tprefix: $current_prefix\n\t major: $current_major\n\t minor: $current_minor\n\t rev: $current_revision\n\t age: $current_age\n");
-
- # **********************************
- # Compare the last tag with the current source
- # **********************************
-
- unless (defined $increment) {
- printf("Diffing...\n");
-
- system("cvs diff -r $current_tag $module | less");
- }
-
- # **********************************
- # Generate the new tag name
- # **********************************
-
- printf("\nWhich component do you wish to increment?\n\n\t'j'\tmaJor\n\t'i'\tmInor\n\t'r'\tRevision\n\t'a'\tAge\n\t\'n'\tNo change\n\tfree type\tUse what I have typed (single word) as a new age name (original: $current_age)\n\nType in your choice: ");
-
- unless (defined $increment) {
- $increment=<STDIN>;
- }
-
- chomp($increment);
-
- switch ($increment) {
- case "j" {
- $major=$current_major+1;
- $minor=0;
- $revision=0;
- $age=1;}
- case "i" {
- $major=$current_major;
- $minor=$current_minor+1;
- $revision=0;
- $age=1;}
- case "r" {
- $major=$current_major;
- $minor=$current_minor;
- $revision=$current_revision+1;
- $age=1;}
- case "a" {
- $major=$current_major;
- $minor=$current_minor;
- $revision=$current_revision;
- $age=$current_age+1;}
- case "n" {
- $major=$current_major;
- $minor=$current_minor;
- $revision=$current_revision;
- $age=$current_age;}
- else {
- $major=$current_major;
- $minor=$current_minor;
- $revision=$current_revision;
- $age=$increment;}
- }
- $tag="$current_prefix" . "$major" . "_$minor" . "_$revision" . "_$age";
-
- printf("\nNew tag: $tag\n\n");
-
- die "This tag already exists; reported by assertion" unless (($increment eq 'n') || system("cvs log -h $module/Makefile | grep \"$tag\""));
-
- # **********************************
- # Create the execution script
- # **********************************
-
- open EXEC, ">", "$TMPDIR/etics-tag-$module.$major.$minor.$revision-$age.sh" or die $!;
-
- printf (EXEC "#This script registers tags for the $module module, version $major.$minor.$revision-$age\n#Generated automatically by $0\n\n");
-
-
- # **********************************
- # Update the ChangeLog
- # **********************************
-
- if (-r "$module/project/ChangeLog") { # ChangeLog exists (where expected). Proceed.
-
- $tmpChangeLog="$TMPDIR/$module.ChangeLog.$$";
-
- system("cp $module/project/ChangeLog $tmpChangeLog");
-
- unless ($increment eq "n") {system("echo $major.$minor.$revision-$age >> $tmpChangeLog");}
-
- $ChangeLogRet=system("vim $tmpChangeLog");
-
- printf("Modified ChangeLog ready, ret code: $ChangeLogRet\n");
-
- if (defined $opt_m) {$commit_message=$opt_m;}
- else {$commit_message="Appended the description of changes regarding version $major.$minor.$revision-$age";}
-
- printf(EXEC "#Update and commit the ChangeLog\ncp $tmpChangeLog $module/project/ChangeLog\ncvs commit -m \"$commit_message\" $module/project/ChangeLog\n\n");
-
- }
-
- unless ($increment eq "n") {
- # **********************************
- # Update version.properties
- # **********************************
- open V, "$module/project/version.properties" or die "$module/project/version.properties: $?\n";
-
- printf(EXEC "#Generate new version.properties\ncat >$module/project/version.properties <<EOF\n");
- while ($_ = <V>) {
- chomp;
-
- $_=~s/module\.version\s*=\s*[.0-9]+/module\.version=$major.$minor.$revision/;
- $_=~s/module\.age\s*=\s*(\S+)/module\.age=$age/;
-
- $_=~s/\$/\\\$/g;
- printf(EXEC "$_\n");
- }
- close V;
- printf(EXEC "EOF\n\n");
-
-
- if (defined $opt_m) {$commit_message=$opt_m;}
- else {$commit_message="Modified to reflect version $major.$minor.$revision-$age";}
-
-
- printf(EXEC "cvs commit -m \"$commit_message\" $module/project/version.properties\n\n");
- }
-
-
- # **********************************
- # Update configure
- # **********************************
-
- printf(EXEC "#Update and commit the \"configure\" script\ncp $GLITE_LB_LOCATION/configure $module/\ncvs commit -m \"The most recent version copied. Do not modify this instance (RW in $GLITE_LB_LOCATION).\" $module/configure\n\n");
-
- unless ($increment eq "n") {
- # **********************************
- # Run CVS Tag
- # **********************************
-
- $cwd=`pwd`;
- chomp($cwd);
-
- printf(EXEC "#Register the new tag\ncd $module\ncvs tag \"$tag\"\ncd \"$cwd\"\n");
- }
-
- # **********************************
- # Etics configuration prepare / modify / upload
- # **********************************
-
- $currentconfig="$module_$module" . "_R_$current_major" . "_$current_minor" . "_$current_revision" . "_$current_age";
- $currentconfig=~s/^org.//;
- $currentconfig=~s/\./-/g;
- $newconfig="$module_$module" . "_R_$major" . "_$minor" . "_$revision" . "_$age";
- $newconfig=~s/^org.//;
- $newconfig=~s/\./-/g;
-
- $module=~/([^\.]+?)\.([^\.]+?)$/;
- $subsysname=$1;
- $modulename=$2;
-
- printf("Module=$module\nname=$modulename\nsubsys=$subsysname\n");
- system("$GLITE_LB_LOCATION/configure --mode=etics --module $subsysname.$modulename --output $TMPDIR/$newconfig.ini.$$ --version $major.$minor.$revision-$age");
-
-# printf("\nCurrent configuration:\t$currentconfig\nNew configuration:\t$newconfig\n\nPreparing...\n");
-#
- if (defined $opt_g) {
- system("etics-configuration prepare -o $TMPDIR/$currentconfig.ini.$$ -c $currentconfig $module");
- }
-
-# open OLDCONF, "$TMPDIR/$currentconfig.ini.$$" or die $!;
-# open NEWCONF, ">", "$TMPDIR/$newconfig.ini.$$" or die $!;
-
-# while ($_ = <OLDCONF>) {
-# chomp;
-
-## $_=~s/module\.age\s*=\s*(\S+)/module\.age=$age/;
-# $_=~s/$currentconfig/$newconfig/;
-# $_=~s/^\s*version\s*=\s*[.0-9]+/version = $major.$minor.$revision/;
-# $_=~s/^\s*age\s*=\s*\S+/age = $age/;
-
-# printf(NEWCONF "$_\n");
-# }
-
-# close(OLDCONF);
-# close(NEWCONF);
-
- if ($increment eq "n") { # There was no version change and the configuration should already exist
- printf(EXEC "\n#Add new configuration\netics-configuration modify -i $TMPDIR/$newconfig.ini.$$ -c $newconfig $module\n"); }
- else { # New configuration needs to be created
- printf(EXEC "\n#Add new configuration\netics-configuration add -i $TMPDIR/$newconfig.ini.$$ -c $newconfig $module\n"); }
- printf(EXEC "etics-commit\n");
-
-
- # **********************************
- # Final bows
- # **********************************
-
- close(EXEC);
-
- system("chmod +x \"$TMPDIR/etics-tag-$module.$major.$minor.$revision-$age.sh\"");
-
- printf("\n\n---------\nFinished!\n\nExecution script written in:\t$TMPDIR/etics-tag-$module.$major.$minor.$revision-$age.sh\nChangeLog candidate written in:\t$tmpChangeLog\n");
- printf("Old configuration stored in:\t$TMPDIR/$currentconfig.ini.$$\n") if (defined $opt_g);
- printf("New configuration written in:\t$TMPDIR/$newconfig.ini.$$\n\n");
-
+++ /dev/null
-#!/bin/sh
-
-set -e
-
-#OFFLINE=true
-TOPDIR=${PWD}
-
-export LB4VDTDIR=${TOPDIR}/org.glite.lb/lb4vdt
-export STAGEDIR=${TOPDIR}/stage
-mkdir -p ${STAGEDIR}
-
-if [ ! -f ${LB4VDTDIR}/Makefile.inc ]; then
- echo "Error: There is no ${LB4VDTDIR}/Makefile.inc. Exiting."
- exit 1
-fi
-
-if [ -z "${CVSROOT}" ]; then
- export CVSROOT=:pserver:anonymous@jra1mw.cvs.cern.ch:/cvs/jra1mw
-# export CVSROOT=:ext:jpospi@jra1mw.cvs.cern.ch:/cvs/jra1mw
- echo "Using CVSROOT=${CVSROOT}"
-fi
-
-dep_modules="org.glite.wms-utils.jobid
-org.gridsite.core"
-
-modules="org.glite.security.gsoap-plugin
-org.glite.lb.client-interface
-org.glite.lb.common
-org.glite.lb.client
-org.glite.lb.logger
-org.glite.lb.ws-interface
-org.glite.lb.server-bones
-org.glite.lb.server
-org.glite.lb.proxy"
-#org.glite.lb.utils
-
-for i in $dep_modules;
-do
- echo "*********************************************************"
- echo "* Module $i"
- echo "*********************************************************"
- cd ${TOPDIR}
- if [ -n "${OFFLINE}" ]; then
- echo "Working offline"
- else
- echo "Getting sources from CVS"
- cvs co -A $i;
- fi
- if [ -d $i -a -f ${LB4VDTDIR}/patches/$i.patch -a ! -f .$i.patched ]; then
- echo "Patching $i"
- patch -p0 < ${LB4VDTDIR}/patches/$i.patch
- touch .$i.patched
- fi
- if [ -d $i ]; then
- touch .$i.timestamp
- if [ -f ${LB4VDTDIR}/scripts/$i.build ]; then
- echo "Building"
- sh -x ${LB4VDTDIR}/scripts/$i.build
- fi
- cd ${TOPDIR}
- find ${STAGEDIR} -newer .$i.timestamp > .$i.filelist
- else
- echo "WARNING: directory $i not found"
- fi
-done
-
-for i in $modules;
-do
- echo "*********************************************************"
- echo "* Module $i"
- echo "*********************************************************"
- cd ${TOPDIR}
- if [ -n "${OFFLINE}" ]; then
- echo "Working offline"
- else
- echo "Getting sources from CVS"
- cvs co -A $i;
- fi
- if [ -d $i -a -f ${LB4VDTDIR}/patches/$i.patch -a ! -f .$i.patched ]; then
- echo "Patching $i"
- patch -p0 < ${LB4VDTDIR}/patches/$i.patch
- touch .$i.patched
- fi
- if [ -d $i ]; then
- touch .$i.timestamp
- echo "Entering directory ${TOPDIR}/$i"
- cd ${TOPDIR}/$i
- echo "Copying supporting files"
- cp -rv ${TOPDIR}/org.glite.lb/project/{at3,*.T,*.pm} ./project/
- mkdir -p build
- echo "Entering directory ${TOPDIR}/$i/build"
- cd build
- ln -fsv ../Makefile
-# ln -fsv ../../Makefile.inc Makefile.inc
- ln -fsv ${LB4VDTDIR}/Makefile.inc
- echo "Building"
- make LB_STANDALONE=yes
- make stage LB_STANDALONE=yes
- cd ${TOPDIR}
- find ${STAGEDIR} -newer .$i.timestamp > .$i.filelist
- else
- echo "WARNING: directory $i not found"
- fi
- echo "Done"
-done
-
-cd ${TOPDIR}
-echo "Creating filelists"
-cat .org.glite.wms-utils.jobid.filelist .org.gridsite.core.filelist .org.glite.security.gsoap-plugin.filelist .org.glite.lb.common.filelist | sort | uniq > LB-common.filelist
-cat .org.glite.lb.client-interface.filelist .org.glite.lb.client.filelist | sort | uniq > LB-client.filelist
-cat .org.glite.lb.logger.filelist | sort | uniq > LB-logger.filelist
-cat .org.glite.lb.logger.filelist .org.glite.lb.server-bones.filelist .org.glite.lb.proxy.filelist | sort | uniq > LB-proxy.filelist
-cat .org.glite.lb.ws-interface.filelist .org.glite.lb.server-bones.filelist .org.glite.lb.server.filelist | sort | uniq > LB-server.filelist
+++ /dev/null
-#
-# common setting
-#
-
-#vdt_location=/home/honik/egee/vdt-1.5.0
-vdt_location=${VDT_LOCATION}
-
-# missing packages could be for example downloaded to repository from
-# http://eticssoft.web.cern.ch/eticssoft/repository/externals
-
-repository=/home/honik/egee/repository/externals/
-platform=slc3_ia32_gcc323
-
-
-#
-# external dependencies that are already part of VDT (vdt-1.5.0):
-#
-
-#classads_prefix=${repository}/classads/0.9.8/${platform}
-classads_prefix=${vdt_location}/classads
-
-#globus_prefix=${repository}/globus/2.4.3-VDT-1.2.5/${platform}
-globus_prefix=${vdt_location}/globus
-
-#expat_prefix=/usr
-expat_prefix=${vdt_location}/expat
-
-#mysql_prefix=${repository}/mysql-devel/4.1.11/${platform}
-mysql_prefix=${vdt_location}/mysql
-mysql_version=4.1.21
-
-voms_prefix=${vdt_location}/glite
-#voms_prefix=/home/honik/egee/glite/stage
-
-
-#
-# external dependencies that are NOT (yet) part of VDT (vdt-1.5.0):
-#
-
-#cares_prefix=${repository}/c-ares/1.3.0/${platform}
-cares_prefix=/software/cares-1.3
-
-# probably not needed (used "only" for unit tests - 'make check'):
-#cppunit_prefix=${repository}/cppunit/1.10.2/${platform}
-cppunit_prefix=/software/cppunit-1.10.2
-
-# probably not needed:
-#gridsite_prefix=${stagedir}
-
-gsoap_default_version=2.7.6b
-gsoap_versions=${gsoap_default_version}
-#gsoap_prefix=${repository}/gsoap/${gsoap_default_version}/${platform}
-gsoap_prefix=/software/gsoap-${gsoap_default_version}
-
-
-#
-# some other defaults:
-#
-
-#PREFIX=${vdt_location}/glite
-PREFIX=/tmp/lb4vdt
-globalprefix=glite
-lbprefix=lb
-
-builddir=build
-distdir=${STAGEDIR}/../dist
-stagedir=${STAGEDIR}
-top_srcdir=..
-
-#thrflavour=gcc64dbgpthr
-#nothrflavour=gcc64dbg
-thrflavour=gcc32dbgpthr
-nothrflavour=gcc32dbg
-
-# needed by org.glite.lb.client:
-glite_location=${stagedir}
-
+++ /dev/null
-#!/bin/sh
-
-set -e
-
-TOPDIR=${PWD}
-source ${LB4VDTDIR}/Makefile.inc
-cd org.gridsite.core/src
-make build-lib OPENSSL_FLAGS=-I${globus_prefix}/include/${nothrflavour} OPENSSL_LIBS=-L${globus_prefix}/lib FLAVOR_EXT=_${nothrflavour}
-make install-lib prefix=${STAGEDIR}
-cd ${TOPDIR}
-
+++ /dev/null
-#Fri Aug 18 12:35:01 CEST 2006
-module.build=0242
+++ /dev/null
-ext.gsoap.version=2.7.6b
-ext.gsoap.rep.file=gSOAP-2.7.6b.tar.gz
+++ /dev/null
-<?xml version="1.0"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- gLite Middleware Logging and Bookkeping Configuration Specification File
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Joachim Flammer <Joachim.Flammer@cern.ch>
- Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.16 2006/03/15 17:33:24 akrenek
- merge of 1.5 branch
-
- Revision 1.15 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.14 2005/10/15 20:14:55 jpospi
- remove duplicate lb.utils section
-
- Revision 1.13.2.1.2.1 2005/11/28 10:39:08 akrenek
- merge bug #13928 fix on the pre_cares branch
-
- Revision 1.13.2.1 2005/10/17 16:27:48 akrenek
- merged in the duplicate utils targed patch
-
- Revision 1.15 2005/11/27 21:51:18 eronchie
- Applied fix for bug 13928
-
- Revision 1.14 2005/10/15 20:14:55 jpospi
- remove duplicate lb.utils section
-
- Revision 1.13 2005/10/15 13:36:26 akrenek
- added lb.utils
-
- Revision 1.12 2005/03/16 10:02:52 zsalvet
- proxy component added
-
- Revision 1.11 2004/12/01 18:01:55 zsalvet
- LB here, not R-GMA
-
- Revision 1.10 2004/11/29 16:01:21 zsalvet
- Evaluate component.{head,tag} conditions before use of get.* targets.
-
- Revision 1.9 2004/11/29 15:16:26 zsalvet
- Add ws-interface to checkout/build machinery.
-
- Revision 1.8 2004/10/18 22:55:14 dimeglio
- Added oscheck to various targets
-
- Revision 1.7 2004/10/15 12:30:01 akrenek
- build with lb.sever-bones
-
- Revision 1.6 2004/08/27 10:03:41 zurek
- typo problem
-
- Revision 1.5 2004/08/27 09:13:11 zurek
- changing thee order for build
-
- Revision 1.4 2004/07/29 10:47:46 dimeglio
- Added server and logger
-
- Revision 1.3 2004/07/16 16:25:43 flammer
- Added tags for automated adding of components.
-
- Revision 1.2 2004/06/23 00:22:11 dimeglio
- Added client and client-interface components
-
- Revision 1.1 2004/06/18 23:05:53 dimeglio
- Added/upgraded default build scripts
-
--->
-
-
-<project name="GLite Middleware Logging and Bookkeping CSF" default="all">
-
- <!-- ===============================================
- Determine workspace directory
- =============================================== -->
-
- <!-- Relative workspace root directory -->
- <property name="workspace.dir" value="../.." />
-
- <!-- ===============================================
- Load properties
- =============================================== -->
-
- <!-- load baseline and user properties -->
- <import file="${workspace.dir}/org.glite/project/baseline.properties.xml" />
-
- <!-- define build properties file location since we are already in project dir -->
- <property name="subsystem.build.properties.file" value="./build.properties" />
-
- <!-- Load subsystem-specific property file -->
- <property file="./properties.xml"/>
-
- <!-- load global properties -->
- <import file="${global.properties.file}" />
-
- <!-- ===============================================
- Load dependencies
- =============================================== -->
-
- <!-- Load user dependencies file -->
- <property file="${user.dependencies.file}" />
-
- <!-- Load subsystem dependencies file -->
- <property file="./dependencies.properties" />
-
- <!-- Load global dependencies file -->
- <property file="${global.dependencies.file}" />
-
- <!-- ===============================================
- Load targets
- =============================================== -->
- <import file="${global.targets-envchecks.file}" />
- <import file="${global.targets-external-dependencies.file}" />
-
- <!-- ===============================================
- Evaluate CVS tags
- =============================================== -->
-
- <target name="evaluate.cvs.tags" description="Figure out if we need tagged CVS checkout">
- <condition property="glite.head">
- <and>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
- <condition property="glite.tag">
- <and>
- <not>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- </not>
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
- <condition property="glite-lb.head">
- <and>
- <equals arg1="${org.glite.lb.version}" arg2="HEAD" />
- <istrue value="${update}" />
- </and>
- </condition>
- <condition property="glite-lb.tag">
- <and>
- <not>
- <equals arg1="${org.glite.lb.version}" arg2="HEAD" />
- </not>
- <istrue value="${update}" />
- </and>
- </condition>
-
- <!-- condition property tag = do not remove = -->
-
- <condition property="utils.head">
- <equals arg1="${org.glite.lb.utils.version}" arg2="HEAD" />
- </condition>
-
- <condition property="common.head">
- <equals arg1="${org.glite.lb.common.version}" arg2="HEAD" />
- </condition>
-
- <condition property="server-bones.head">
- <equals arg1="${org.glite.lb.server-bones.version}" arg2="HEAD" />
- </condition>
-
- <condition property="client-interface.head">
- <equals arg1="${org.glite.lb.client-interface.version}" arg2="HEAD" />
- </condition>
-
- <condition property="ws-interface.head">
- <equals arg1="${org.glite.lb.ws-interface.version}" arg2="HEAD" />
- </condition>
-
- <condition property="client.head">
- <equals arg1="${org.glite.lb.client.version}" arg2="HEAD" />
- </condition>
-
- <condition property="server.head">
- <equals arg1="${org.glite.lb.server.version}" arg2="HEAD" />
- </condition>
-
- <condition property="proxy.head">
- <equals arg1="${org.glite.lb.proxy.version}" arg2="HEAD" />
- </condition>
-
- <condition property="logger.head">
- <equals arg1="${org.glite.lb.logger.version}" arg2="HEAD" />
- </condition>
-
- </target>
-
- <presetdef name="cvs-co">
- <cvs command="checkout" dest="${workspace.dir}" />
- </presetdef>
-
- <!-- =====================================================
- Self-update if required
- ===================================================== -->
-
- <!-- Update main GLite module -->
- <target name="org.glite" depends="evaluate.cvs.tags, get.glite.head, get.glite.tag"/>
- <target name="get.glite.head" if="glite.head">
- <cvs-co package="org.glite" />
- </target>
- <target name="get.glite.tag" if="glite.tag">
- <cvs-co package="org.glite"
- tag="${org.glite.version}" />
- </target>
-
- <!-- Update the current module -->
- <target name="org.glite.lb" depends="evaluate.cvs.tags, get.glite-lb.head, get.glite-lb.tag"/>
- <target name="get.glite-lb.head" if="glite-lb.head">
- <cvs-co package="org.glite.lb" />
- <fail>The org.glite and org.glite.lb modules have been updated, please rerun the configuration file</fail>
- </target>
- <target name="get.glite-lb.tag" if="glite-lb.tag">
- <cvs-co package="org.glite.lb"
- tag="${org.glite.lb.version}" />
- <fail>The org.glite and org.glite.lb modules have been updated, please rerun the configuration file</fail>
- </target>
-
- <!-- *****************************************************-->
- <!-- Development tools -->
- <!-- *****************************************************-->
-
- <!-- All development tools -->
- <target name="devtools" depends="oscheck,
- evaluate.cvs.tags,
- junitcheck,
- junit,
- chkstyle,
- jalopy,
- ant-contrib,
- cpptasks,
- egee-ant-ext"
- description="Get development tools into repository."/>
-
- <!-- =====================================================
- External libraries
- ===================================================== -->
-
- <!-- All external libraries -->
- <target name="external" depends="oscheck,
- evaluate.cvs.tags,
- classads,
- globus"
- description="Install external packages"/>
-
- <!-- =====================================================
- GLite Middleware LB modules
- ===================================================== -->
-
- <!-- component targets tag = do not remove = -->
-
- <!-- common -->
- <target name="common" depends="evaluate.cvs.tags, get.common.head, get.common.tag"/>
- <target name="get.common.head" if="common.head">
- <cvs-co package="org.glite.lb.common" />
- </target>
- <target name="get.common.tag" unless="common.head">
- <cvs-co package="org.glite.lb.common"
- tag="${org.glite.lb.common.version}" />
- </target>
-
- <!-- server-bones -->
- <target name="server-bones" depends="evaluate.cvs.tags, get.server-bones.head, get.server-bones.tag"/>
- <target name="get.server-bones.head" if="server-bones.head">
- <cvs-co package="org.glite.lb.server-bones" />
- </target>
- <target name="get.server-bones.tag" unless="server-bones.head">
- <cvs-co package="org.glite.lb.server-bones"
- tag="${org.glite.lb.server-bones.version}" />
- </target>
-
- <!-- client-interface -->
- <target name="client-interface" depends="evaluate.cvs.tags, get.client-interface.head, get.client-interface.tag"/>
- <target name="get.client-interface.head" if="client-interface.head">
- <cvs-co package="org.glite.lb.client-interface" />
- </target>
- <target name="get.client-interface.tag" unless="client-interface.head">
- <cvs-co package="org.glite.lb.client-interface"
- tag="${org.glite.lb.client-interface.version}" />
- </target>
-
- <!-- WS interface -->
- <target name="ws-interface" depends="evaluate.cvs.tags, get.ws-interface.head, get.ws-interface.tag"/>
- <target name="get.ws-interface.head" if="ws-interface.head">
- <cvs-co package="org.glite.lb.ws-interface" />
- </target>
- <target name="get.ws-interface.tag" unless="ws-interface.head">
- <cvs-co package="org.glite.lb.ws-interface"
- tag="${org.glite.lb.ws-interface.version}" />
- </target>
-
- <!-- client -->
- <target name="client" depends="evaluate.cvs.tags, get.client.head, get.client.tag"/>
- <target name="get.client.head" if="client.head">
- <cvs-co package="org.glite.lb.client" />
- </target>
- <target name="get.client.tag" unless="client.head">
- <cvs-co package="org.glite.lb.client"
- tag="${org.glite.lb.client.version}" />
- </target>
-
- <!-- server -->
- <target name="server" depends="evaluate.cvs.tags, get.server.head, get.server.tag"/>
- <target name="get.server.head" if="server.head">
- <cvs-co package="org.glite.lb.server" />
- </target>
- <target name="get.server.tag" unless="server.head">
- <cvs-co package="org.glite.lb.server"
- tag="${org.glite.lb.server.version}" />
- </target>
-
- <!-- proxy -->
- <target name="proxy" depends="evaluate.cvs.tags, get.proxy.head, get.proxy.tag"/>
- <target name="get.proxy.head" if="proxy.head">
- <cvs-co package="org.glite.lb.proxy" />
- </target>
- <target name="get.proxy.tag" unless="proxy.head">
- <cvs-co package="org.glite.lb.proxy"
- tag="${org.glite.lb.proxy.version}" />
- </target>
-
- <!-- logger -->
- <target name="logger" depends="evaluate.cvs.tags, get.logger.head, get.logger.tag"/>
- <target name="get.logger.head" if="logger.head">
- <cvs-co package="org.glite.lb.logger" />
- </target>
- <target name="get.logger.tag" unless="logger.head">
- <cvs-co package="org.glite.lb.logger"
- tag="${org.glite.lb.logger.version}" />
- </target>
-
- <!-- utils -->
- <target name="utils" depends="get.utils.head, get.utils.tag"/>
- <target name="get.utils.head" if="utils.head">
- <cvs-co package="org.glite.lb.utils" />
- </target>
- <target name="get.utils.tag" unless="utils.head">
- <cvs-co package="org.glite.lb.utils"
- tag="${org.glite.lb.utils.version}" />
- </target>
-
- <!-- All project modules -->
- <target name="project" depends="utils,
- client-interface,
- ws-interface,
- common,
- server-bones,
- client,
- server,
- proxy,
- logger"/>
-
-
- <!-- ====================================================
- Checkout all
- ==================================================== -->
-
- <!-- All libraries -->
- <target name="all" depends="oscheck,evaluate.cvs.tags, defaultenvchecks, org.glite, org.glite.lb, devtools, external, project" />
-
- <!-- ====================================================
- Print dependecies to console
- ==================================================== -->
-
- <target name="dependencies">
- <concat>
- <fileset dir="." includes="dependencies.properties" />
- </concat>
- </target>
-
-</project>
+++ /dev/null
-gLite Logging and Bookkeeping (LB) is a Grid service that keeps a short-term trace of Grid jobs as they are processed by individual Grid components.
+++ /dev/null
-gLite Logging and Bookkeeping
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the gLite LB modules
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Logging and Bookkeping subsystem common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property name="subsystem.build.properties.file" value="./project/build.properties" />
- <property file="${subsystem.build.properties.file}" />
-
- <!-- ======================================================
- Define subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${lb.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${lb.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define general subsystem properties
- ====================================================== -->
-
- <!-- Include common subsystem properties -->
- <import file="${subsystem.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-cd ../..
-
-cvs co org.glite
-cvs co org.glite.lb
-
-cd org.glite.lb/project
-ant -f glite.lb.csf.xml
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common Ant task definition file for the gLite Logging and Bookeeping modules
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Logging and Bookeeping subsystem common tasks and types definitions">
-
- <!-- ======================================================
- Subsystem task definitions
- ====================================================== -->
-
-</project>
\ No newline at end of file
+++ /dev/null
-# : /cvs/glite/org.glite.lb/project/version.properties,v 1.164 2008/01/09 15:35:55 mmulac Exp $
-module.version=2.0.5
-module.age=7