import FCGI-ProcManager 0.17 from CPAN
[catagits/FCGI-ProcManager.git] / ProcManager.pm
CommitLineData
0baf5fac 1package FCGI::ProcManager;
2
3# Copyright (c) 2000, FundsXpress Financial Network, Inc.
4# This library is free software released under the GNU Lesser General
5# Public License, Version 2.1. Please read the important licensing and
6# disclaimer information included below.
7
50f238cd 8# $Id: ProcManager.pm,v 1.23 2001/04/23 16:10:11 muaddie Exp $
0baf5fac 9
10use strict;
4ceac1a1 11use Exporter;
50f238cd 12use POSIX qw(:signal_h);
4ceac1a1 13
50f238cd 14use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS $Q $SIG_CODEREF);
0baf5fac 15BEGIN {
50f238cd 16 $VERSION = '0.17';
4ceac1a1 17 @ISA = qw(Exporter);
c2bbadb3 18 @EXPORT_OK = qw(pm_manage pm_die pm_wait
4ceac1a1 19 pm_write_pid_file pm_remove_pid_file
c146b63d 20 pm_pre_dispatch pm_post_dispatch
518709ed 21 pm_change_process_name pm_received_signal pm_parameter
50f238cd 22 pm_warn pm_notify pm_abort pm_exit
23 $SIG_CODEREF);
4ceac1a1 24 $EXPORT_TAGS{all} = \@EXPORT_OK;
25 $FCGI::ProcManager::Default = 'FCGI::ProcManager';
0baf5fac 26}
27
28=head1 NAME
29
30 FCGI::ProcManager - functions for managing FastCGI applications.
31
32=head1 SYNOPSIS
33
518709ed 34{
35 # In Object-oriented style.
0baf5fac 36 use CGI::Fast;
37 use FCGI::ProcManager;
c2bbadb3 38 my $proc_manager = FCGI::ProcManager->new({
39 n_processes => 10
40 });
518709ed 41 $proc_manager->pm_manage();
0baf5fac 42 while (my $cgi = CGI::Fast->new()) {
518709ed 43 $proc_manager->pm_pre_dispatch();
44 # ... handle the request here ...
45 $proc_manager->pm_post_dispatch();
46 }
47
48 # This style is also supported:
49 use CGI::Fast;
c2bbadb3 50 use FCGI::ProcManager qw(pm_manage pm_pre_dispatch
51 pm_post_dispatch);
518709ed 52 pm_manage( n_processes => 10 );
53 while (my $cgi = CGI::Fast->new()) {
54 pm_pre_dispatch();
0baf5fac 55 #...
518709ed 56 pm_post_dispatch();
57 }
0baf5fac 58
59=head1 DESCRIPTION
60
518709ed 61FCGI::ProcManager is used to serve as a FastCGI process manager. By
62re-implementing it in perl, developers can more finely tune performance in
63their web applications, and can take advantage of copy-on-write semantics
64prevalent in UNIX kernel process management. The process manager should
65be invoked before the caller''s request loop
66
67The primary routine, C<pm_manage>, enters a loop in which it maintains a
68number of FastCGI servers (via fork(2)), and which reaps those servers
69when they die (via wait(2)).
70
71C<pm_manage> provides too hooks:
72
73 C<managing_init> - called just before the manager enters the manager loop.
74 C<handling_init> - called just before a server is returns from C<pm_manage>
75
76It is necessary for the caller, when implementing its request loop, to
77insert a call to C<pm_pre_dispatch> at the top of the loop, and then
787C<pm_post_dispatch> at the end of the loop.
79
50f238cd 80=head2 Signal Handling
81
82FCGI::ProcManager attempts to do the right thing for proper shutdowns now.
83
84When it receives a SIGHUP, it sends a SIGTERM to each of its children, and
85then resumes its normal operations.
86
87When it receives a SIGTERM, it sends a SIGTERM to each of its children, sets
88an alarm(3) "die timeout" handler, and waits for each of its children to
89die. If all children die before this timeout, process manager exits with
90return status 0. If all children do not die by the time the "die timeout"
91occurs, the process manager sends a SIGKILL to each of the remaining
92children, and exists with return status 1.
93
94In order to get FastCGI servers to exit upon receiving a signal, it is
95necessary to use its FAIL_ACCEPT_ON_INTR. See FCGI.pm's description of
96FAIL_ACCEPT_ON_INTR. Unfortunately, if you want/need to use CGI::Fast, it
97appears currently necessary to modify your installation of FCGI.pm, with
98something like the following:
99
100 -*- patch -*-
101 --- FCGI.pm 2001/03/09 01:44:00 1.1.1.3
102 +++ FCGI.pm 2001/03/09 01:47:32 1.2
103 @@ -24,7 +24,7 @@
104 *FAIL_ACCEPT_ON_INTR = sub() { 1 };
105
106 sub Request(;***$$$) {
107 - my @defaults = (\*STDIN, \*STDOUT, \*STDERR, \%ENV, 0, 0);
108 + my @defaults = (\*STDIN, \*STDOUT, \*STDERR, \%ENV, 0, FAIL_ACCEPT_ON_INTR());
109 splice @defaults,0,@_,@_;
110 RequestX(@defaults);
111 }
112 -*- end patch -*-
113
114Otherwise, if you don't, there is a loop around accept(2) which prevents
115os_unix.c OS_Accept() from returning the necessary error when FastCGI
116servers blocking on accept(2) receive the SIGTERM or SIGHUP.
117
118FCGI::ProcManager uses POSIX::sigaction() to override the default SA_RESTART
119policy used for perl's %SIG behavior. Specifically, the process manager
120never uses SA_RESTART, while the child FastCGI servers turn off SA_RESTART
121around the accept(2) loop, but re-enstate it otherwise.
122
123The desired (and implemented) effect is to give a request as big a chance as
124possible to succeed and to delay their exits until after their request,
125while allowing the FastCGI servers waiting for new requests to die right
126away.
0baf5fac 127
128=head1 METHODS
129
130=head2 new
131
c2bbadb3 132 class or instance
133 (ProcManager) new([hash parameters])
134
135Constructs a new process manager. Takes an option has of initial parameter
136values, and assigns these to the constructed object HASH, overriding any
137default values. The default parameter values currently are:
138
139 role => manager
140 start_delay => 0
141 die_timeout => 60
142
0baf5fac 143=cut
144
145sub new {
146 my ($proto,$init) = @_;
50f238cd 147 $init ||= {};
0baf5fac 148
518709ed 149 my $this = {
150 role => "manager",
151 start_delay => 0,
50f238cd 152 die_timeout => 60,
153 %$init
518709ed 154 };
4ceac1a1 155 bless $this, ref($proto)||$proto;
0baf5fac 156
157 $this->{PIDS} = {};
158
50f238cd 159 # initialize signal constructions.
160 unless ($this->no_signals()) {
161 $this->{sigaction_no_sa_restart} =
162 POSIX::SigAction->new('FCGI::ProcManager::sig_sub');
163 $this->{sigaction_sa_restart} =
164 POSIX::SigAction->new('FCGI::ProcManager::sig_sub',undef,POSIX::SA_RESTART);
165 }
166
0baf5fac 167 return $this;
168}
169
518709ed 170=head1 Manager methods
4ceac1a1 171
172=head2 pm_manage
0baf5fac 173
c2bbadb3 174 instance or export
175 (int) pm_manage([hash parameters])
0baf5fac 176
177DESCRIPTION:
178
c2bbadb3 179When this is called by a FastCGI script to manage application servers. It
180defines a sequence of instructions for a process to enter this method and
181begin forking off and managing those handlers, and it defines a sequence of
182instructions to intialize those handlers.
183
184If n_processes < 1, the managing section is subverted, and only the
185handling sequence is executed.
186
187Either returns the return value of pm_die() and/or pm_abort() (which will
188not ever return in general), or returns 1 to the calling script to begin
189handling requests.
0baf5fac 190
191=cut
192
4ceac1a1 193sub pm_manage {
518709ed 194 my ($this,%values) = self_or_default(@_);
195 map { $this->pm_parameter($_,$values{$_}) } keys %values;
0baf5fac 196
518709ed 197 # skip to handling now if we won't be managing any processes.
50f238cd 198 $this->n_processes() or return;
0baf5fac 199
518709ed 200 # call the (possibly overloaded) management initialization hook.
201 $this->role("manager");
c146b63d 202 $this->managing_init();
518709ed 203 $this->pm_notify("initialized");
0baf5fac 204
518709ed 205 my $manager_pid = $$;
0baf5fac 206
518709ed 207 MANAGING_LOOP: while (1) {
208
209 # if the calling process goes away, perform cleanup.
210 getppid() == 1 and
211 return $this->pm_die("calling process has died");
0baf5fac 212
518709ed 213 $this->n_processes() > 0 or
214 return $this->pm_die();
0baf5fac 215
518709ed 216 # while we have fewer servers than we want.
217 PIDS: while (keys(%{$this->{PIDS}}) < $this->n_processes()) {
218
219 if (my $pid = fork()) {
220 # the manager remembers the server.
0baf5fac 221 $this->{PIDS}->{$pid} = { pid=>$pid };
518709ed 222 $this->pm_notify("server (pid $pid) started");
0baf5fac 223
224 } elsif (! defined $pid) {
518709ed 225 return $this->pm_abort("fork: $!");
0baf5fac 226
227 } else {
518709ed 228 $this->{MANAGER_PID} = $manager_pid;
229 # the server exits the managing loop.
230 last MANAGING_LOOP;
0baf5fac 231 }
0baf5fac 232
518709ed 233 for (my $s = $this->start_delay(); $s; $s = sleep $s) {};
234 }
c146b63d 235
518709ed 236 # this should block until the next server dies.
c2bbadb3 237 $this->pm_wait();
0baf5fac 238
239 }# while 1
240
518709ed 241HANDLING:
0baf5fac 242
c2bbadb3 243 # forget any children we had been collecting.
244 delete $this->{PIDS};
245
518709ed 246 # call the (possibly overloaded) handling init hook
247 $this->role("server");
c146b63d 248 $this->handling_init();
518709ed 249 $this->pm_notify("initialized");
0baf5fac 250
518709ed 251 # server returns
0baf5fac 252 return 1;
253}
254
c146b63d 255=head2 managing_init
0baf5fac 256
c2bbadb3 257 instance
258 () managing_init()
259
260DESCRIPTION:
261
262Overrideable method which initializes a process manager. In order to
263handle signals, manage the PID file, and change the process name properly,
264any method which overrides this should call SUPER::managing_init().
265
0baf5fac 266=cut
267
c146b63d 268sub managing_init {
c2bbadb3 269 my ($this) = @_;
0baf5fac 270
518709ed 271 # begin to handle signals.
50f238cd 272 # We do NOT want SA_RESTART in the process manager.
273 # -- we want start the shutdown sequence immediately upon SIGTERM.
274 unless ($this->no_signals()) {
275 sigaction(SIGTERM, $this->{sigaction_no_sa_restart}) or
276 $this->pm_warn("sigaction: SIGTERM: $!");
277 sigaction(SIGHUP, $this->{sigaction_no_sa_restart}) or
278 $this->pm_warn("sigaction: SIGHUP: $!");
279 $SIG_CODEREF = sub { $this->sig_manager(@_) };
280 }
0baf5fac 281
518709ed 282 # change the name of this process as it appears in ps(1) output.
283 $this->pm_change_process_name("perl-fcgi-pm");
0baf5fac 284
518709ed 285 $this->pm_write_pid_file();
0baf5fac 286}
287
518709ed 288=head2 pm_die
0baf5fac 289
c2bbadb3 290 instance or export
291 () pm_die(string msg[, int exit_status])
292
293DESCRIPTION:
294
295This method is called when a process manager receives a notification to
296shut itself down. pm_die() attempts to shutdown the process manager
297gently, sending a SIGTERM to each managed process, waiting die_timeout()
298seconds to reap each process, and then exit gracefully once all children
299are reaped, or to abort if all children are not reaped.
300
0baf5fac 301=cut
302
518709ed 303sub pm_die {
304 my ($this,$msg,$n) = self_or_default(@_);
305
306 # stop handling signals.
50f238cd 307 undef $SIG_CODEREF;
518709ed 308 $SIG{HUP} = 'DEFAULT';
309 $SIG{TERM} = 'DEFAULT';
310
311 $this->pm_remove_pid_file();
312
313 # prepare to die no matter what.
314 if (defined $this->die_timeout()) {
50f238cd 315 $SIG{ALRM} = sub { $this->pm_abort("wait timeout") };
518709ed 316 alarm $this->die_timeout();
317 }
318
319 # send a TERM to each of the servers.
50f238cd 320 if (my @pids = keys %{$this->{PIDS}}) {
321 $this->pm_notify("sending TERM to PIDs, @pids");
322 kill "TERM", @pids;
323 }
518709ed 324
325 # wait for the servers to die.
326 while (%{$this->{PIDS}}) {
c2bbadb3 327 $this->pm_wait();
518709ed 328 }
329
330 # die already.
331 $this->pm_exit("dying: ".$msg,$n);
0baf5fac 332}
333
c2bbadb3 334=head2 pm_wait
335
336 instance or export
337 (int pid) pm_wait()
338
339DESCRIPTION:
340
341This calls wait() which suspends execution until a child has exited.
342If the process ID returned by wait corresponds to a managed process,
343pm_notify() is called with the exit status of that process.
344pm_wait() returns with the return value of wait().
0baf5fac 345
346=cut
347
c2bbadb3 348sub pm_wait {
4ceac1a1 349 my ($this) = self_or_default(@_);
518709ed 350
351 # wait for the next server to die.
352 next if (my $pid = wait()) < 0;
353
354 # notify when one of our servers have died.
355 delete $this->{PIDS}->{$pid} and
356 $this->pm_notify("server (pid $pid) exited with status $?");
c2bbadb3 357
358 return $pid;
0baf5fac 359}
360
c146b63d 361=head2 pm_write_pid_file
0baf5fac 362
c2bbadb3 363 instance or export
364 () pm_write_pid_file([string filename])
365
366DESCRIPTION:
367
368Writes current process ID to optionally specified file. If no filename is
369specified, it uses the value of the C<pid_fname> parameter.
370
0baf5fac 371=cut
372
4ceac1a1 373sub pm_write_pid_file {
374 my ($this,$fname) = self_or_default(@_);
0baf5fac 375 $fname ||= $this->pid_fname() or return;
376 if (!open PIDFILE, ">$fname") {
518709ed 377 $this->pm_warn("open: $fname: $!");
0baf5fac 378 return;
379 }
380 print PIDFILE "$$\n";
381 close PIDFILE;
382}
383
c146b63d 384=head2 pm_remove_pid_file
0baf5fac 385
c2bbadb3 386 instance or export
387 () pm_remove_pid_file()
388
389DESCRIPTION:
390
391Removes optionally specified file. If no filename is specified, it uses
392the value of the C<pid_fname> parameter.
393
0baf5fac 394=cut
395
4ceac1a1 396sub pm_remove_pid_file {
397 my ($this,$fname) = self_or_default(@_);
0baf5fac 398 $fname ||= $this->pid_fname() or return;
518709ed 399 my $ret = unlink($fname) or $this->pm_warn("unlink: $fname: $!");
0baf5fac 400 return $ret;
401}
402
50f238cd 403=head2 sig_sub
404
405 instance
406 () sig_sub(string name)
407
408DESCRIPTION:
409
410The name of this method is passed to POSIX::sigaction(), and handles signals
411for the process manager. If $SIG_CODEREF is set, then the input arguments
412to this are passed to a call to that.
413
414=cut
415
416sub sig_sub {
417 $SIG_CODEREF->(@_) if ref $SIG_CODEREF;
418}
419
518709ed 420=head2 sig_manager
0baf5fac 421
c2bbadb3 422 instance
423 () sig_manager(string name)
424
425DESCRIPTION:
426
427Handles signals of the process manager. Takes as input the name of signal
428being handled.
429
0baf5fac 430=cut
431
518709ed 432sub sig_manager {
433 my ($this,$name) = @_;
50f238cd 434 if ($name eq "TERM") {
c2bbadb3 435 $this->pm_notify("received signal $name");
436 $this->pm_die("safe exit from signal $name");
50f238cd 437 } elsif ($name eq "HUP") {
438 # send a TERM to each of the servers, and pretend like nothing happened..
439 if (my @pids = keys %{$this->{PIDS}}) {
440 $this->pm_notify("sending TERM to PIDs, @pids");
441 kill "TERM", @pids;
442 }
518709ed 443 } else {
444 $this->pm_notify("ignoring signal $name");
445 }
0baf5fac 446}
447
518709ed 448=head1 Handler methods
0baf5fac 449
518709ed 450=head2 handling_init
0baf5fac 451
c2bbadb3 452 instance or export
453 () handling_init()
454
455DESCRIPTION:
456
0baf5fac 457=cut
458
518709ed 459sub handling_init {
c2bbadb3 460 my ($this) = @_;
0baf5fac 461
518709ed 462 # begin to handle signals.
50f238cd 463 # We'll want accept(2) to return -1(EINTR) on caught signal..
464 unless ($this->no_signals()) {
465 sigaction(SIGTERM, $this->{sigaction_no_sa_restart}) or $this->pm_warn("sigaction: SIGTERM: $!");
466 sigaction(SIGHUP, $this->{sigaction_no_sa_restart}) or $this->pm_warn("sigaction: SIGHUP: $!");
467 $SIG_CODEREF = sub { $this->sig_handler(@_) };
468 }
0baf5fac 469
518709ed 470 # change the name of this process as it appears in ps(1) output.
471 $this->pm_change_process_name("perl-fcgi");
0baf5fac 472}
473
518709ed 474=head2 pm_pre_dispatch
0baf5fac 475
c2bbadb3 476 instance or export
477 () pm_pre_dispatch()
478
479DESCRIPTION:
480
0baf5fac 481=cut
482
518709ed 483sub pm_pre_dispatch {
4ceac1a1 484 my ($this) = self_or_default(@_);
50f238cd 485
486 # Now, we want the request to continue unhindered..
487 unless ($this->no_signals()) {
488 sigaction(SIGTERM, $this->{sigaction_sa_restart}) or $this->pm_warn("sigaction: SIGTERM: $!");
489 sigaction(SIGHUP, $this->{sigaction_sa_restart}) or $this->pm_warn("sigaction: SIGHUP: $!");
490 }
0baf5fac 491}
492
518709ed 493=head2 pm_post_dispatch
0baf5fac 494
c2bbadb3 495 instance or export
496 () pm_post_dispatch()
497
498DESCRIPTION:
499
0baf5fac 500=cut
501
518709ed 502sub pm_post_dispatch {
4ceac1a1 503 my ($this) = self_or_default(@_);
518709ed 504 if ($this->pm_received_signal("TERM")) {
505 $this->pm_exit("safe exit after SIGTERM");
506 }
507 if ($this->pm_received_signal("HUP")) {
508 $this->pm_exit("safe exit after SIGHUP");
509 }
c2bbadb3 510 if ($this->{MANAGER_PID} and getppid() != $this->{MANAGER_PID}) {
518709ed 511 $this->pm_exit("safe exit: manager has died");
512 }
50f238cd 513 # We'll want accept(2) to return -1(EINTR) on caught signal..
514 unless ($this->no_signals()) {
515 sigaction(SIGTERM, $this->{sigaction_no_sa_restart}) or $this->pm_warn("sigaction: SIGTERM: $!");
516 sigaction(SIGHUP, $this->{sigaction_no_sa_restart}) or $this->pm_warn("sigaction: SIGHUP: $!");
517 }
0baf5fac 518}
519
518709ed 520=head2 sig_handler
0baf5fac 521
c2bbadb3 522 instance or export
523 () sig_handler()
524
525DESCRIPTION:
526
0baf5fac 527=cut
528
518709ed 529sub sig_handler {
c146b63d 530 my ($this,$name) = @_;
518709ed 531 $this->pm_received_signal($name,1);
532}
533
534=head1 Common methods and routines
535
536=head2 self_or_default
537
538 private global
539 (ProcManager, @args) self_or_default([ ProcManager, ] @args);
540
541DESCRIPTION:
542
543This is a helper subroutine to acquire or otherwise create a singleton
544default object if one is not passed in, e.g., a method call.
545
546=cut
547
548sub self_or_default {
549 return @_ if defined $_[0] and !ref $_[0] and $_[0] eq 'FCGI::ProcManager';
550 if (!defined $_[0] or (ref($_[0]) ne 'FCGI::ProcManager' and
551 !UNIVERSAL::isa($_[0],'FCGI::ProcManager'))) {
552 $Q or $Q = $FCGI::ProcManager::Default->new;
553 unshift @_, $Q;
0baf5fac 554 }
518709ed 555 return wantarray ? @_ : $Q;
556}
557
558=head2 pm_change_process_name
559
c2bbadb3 560 instance or export
561 () pm_change_process_name()
562
563DESCRIPTION:
564
518709ed 565=cut
566
567sub pm_change_process_name {
568 my ($this,$name) = self_or_default(@_);
569 $0 = $name;
570}
571
572=head2 pm_received_signal
573
c2bbadb3 574 instance or export
575 () pm_received signal()
576
577DESCRIPTION:
578
518709ed 579=cut
580
581sub pm_received_signal {
582 my ($this,$sig,$received) = self_or_default(@_);
583 $sig or return $this->{SIG_RECEIVED};
584 $received and $this->{SIG_RECEIVED}->{$sig}++;
585 return $this->{SIG_RECEIVED}->{$sig};
586}
587
c2bbadb3 588=head1 parameters
589
518709ed 590=head2 pm_parameter
591
c2bbadb3 592 instance or export
593 () pm_parameter()
594
595DESCRIPTION:
596
518709ed 597=cut
598
599sub pm_parameter {
600 my ($this,$key,$value) = self_or_default(@_);
601 defined $value and $this->{$key} = $value;
602 return $this->{$key};
0baf5fac 603}
604
518709ed 605=head2 n_processes
606
607=head2 no_signals
608
609=head2 pid_fname
610
611=head2 die_timeout
612
613=head2 role
614
615=head2 start_delay
616
c2bbadb3 617DESCRIPTION:
618
518709ed 619=cut
620
621sub n_processes { shift->pm_parameter("n_processes", @_); }
622sub pid_fname { shift->pm_parameter("pid_fname", @_); }
623sub no_signals { shift->pm_parameter("no_signals", @_); }
624sub die_timeout { shift->pm_parameter("die_timeout", @_); }
625sub role { shift->pm_parameter("role", @_); }
626sub start_delay { shift->pm_parameter("start_delay", @_); }
627
c2bbadb3 628=head1 notification and death
629
c146b63d 630=head2 pm_warn
0baf5fac 631
c2bbadb3 632 instance or export
633 () pm_warn()
634
635DESCRIPTION:
636
0baf5fac 637=cut
638
4ceac1a1 639sub pm_warn {
640 my ($this,$msg) = self_or_default(@_);
518709ed 641 $this->pm_notify($msg);
642}
643
644=head2 pm_notify
645
c2bbadb3 646 instance or export
647 () pm_notify()
648
649DESCRIPTION:
650
518709ed 651=cut
652
653sub pm_notify {
654 my ($this,$msg) = self_or_default(@_);
655 $msg =~ s/\s*$/\n/;
656 print STDERR "FastCGI: ".$this->role()." (pid $$): ".$msg;
0baf5fac 657}
658
c2bbadb3 659=head2 pm_exit
660
661 instance or export
662 () pm_exit(string msg[, int exit_status])
663
664DESCRIPTION:
0baf5fac 665
666=cut
667
4ceac1a1 668sub pm_exit {
669 my ($this,$msg,$n) = self_or_default(@_);
0baf5fac 670 $n ||= 0;
c2bbadb3 671
672 # if we still have children at this point, something went wrong.
673 # SIGKILL them now.
674 kill "KILL", keys %{$this->{PIDS}} if $this->{PIDS};
675
4ceac1a1 676 $this->pm_warn($msg);
0baf5fac 677 $@ = $msg;
678 exit $n;
679}
680
c146b63d 681=head2 pm_abort
0baf5fac 682
c2bbadb3 683 instance or export
684 () pm_abort(string msg[, int exit_status])
685
686DESCRIPTION:
687
0baf5fac 688=cut
689
4ceac1a1 690sub pm_abort {
691 my ($this,$msg,$n) = self_or_default(@_);
0baf5fac 692 $n ||= 1;
4ceac1a1 693 $this->pm_exit($msg,1);
0baf5fac 694}
695
6961;
697__END__
698
699=head1 BUGS
700
701No known bugs, but this does not mean no bugs exist.
702
703=head1 SEE ALSO
704
705L<FCGI>.
706
707=head1 COPYRIGHT
708
709 FCGI-ProcManager - A Perl FCGI Process Manager
710 Copyright (c) 2000, FundsXpress Financial Network, Inc.
711
712 This library is free software; you can redistribute it and/or
713 modify it under the terms of the GNU Lesser General Public
714 License as published by the Free Software Foundation; either
715 version 2 of the License, or (at your option) any later version.
716
717 BECAUSE THIS LIBRARY IS LICENSED FREE OF CHARGE, THIS LIBRARY IS
718 BEING PROVIDED "AS IS WITH ALL FAULTS," WITHOUT ANY WARRANTIES
719 OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT
720 LIMITATION, ANY IMPLIED WARRANTIES OF TITLE, NONINFRINGEMENT,
721 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND THE
722 ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY,
723 AND EFFORT IS WITH THE YOU. See the GNU Lesser General Public
724 License for more details.
725
726 You should have received a copy of the GNU Lesser General Public
727 License along with this library; if not, write to the Free Software
728 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
729
730=cut