[interchange-cvs] interchange - pajamian modified 4 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Sun Aug 12 03:00:43 EDT 2007
User: pajamian
Date: 2007-08-12 07:00:43 GMT
Modified: . WHATSNEW-5.5
Modified: lib/Vend Dispatch.pm Server.pm
Modified: scripts interchange.PL
Log:
New Vend::Server::set_process_name sub which is used to change the status of
the process name indicator. This respects the MV_DOLLAR_ZERO settings.
Revision Changes Path
1.55 +3 -0 interchange/WHATSNEW-5.5
rev 1.55, prev_rev 1.54
Index: WHATSNEW-5.5
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.5,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- WHATSNEW-5.5 10 Aug 2007 12:05:34 -0000 1.54
+++ WHATSNEW-5.5 12 Aug 2007 07:00:43 -0000 1.55
@@ -120,6 +120,9 @@
* Pass applylocale option into Vend::Form::options_to_array in order to
localize option labels (#80).
+* New set_process_name sub which is used to change the status in the process
+ name indicator.
+
UserDB
------
1.86 +10 -10 interchange/lib/Vend/Dispatch.pm
rev 1.86, prev_rev 1.85
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- Dispatch.pm 10 Aug 2007 08:42:09 -0000 1.85
+++ Dispatch.pm 12 Aug 2007 07:00:43 -0000 1.86
@@ -1,6 +1,6 @@
# Vend::Dispatch - Handle Interchange page requests
#
-# $Id: Dispatch.pm,v 1.85 2007/08/10 08:42:09 pajamian Exp $
+# $Id: Dispatch.pm,v 1.86 2007/08/12 07:00:43 pajamian Exp $
#
# Copyright (C) 2002-2007 Interchange Development Group
# Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
package Vend::Dispatch;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.85 $, 10);
+$VERSION = substr(q$Revision: 1.86 $, 10);
use POSIX qw(strftime);
use Vend::Util;
@@ -1215,12 +1215,12 @@
## If returns false then was a 404 no catalog or a delivered image
open_cat() or return 1;
- $0 = "interchange: $Vend::Cat $CGI::host";
+ Vend::Server::set_process_name("$Vend::Cat $CGI::host");
$CGI::user = Vend::Util::check_authorization($CGI::authorization)
if defined $CGI::authorization;
- my($sessionid, $seed);
+ my($sessionid, $seed);
$sessionid = $CGI::values{mv_session_id} || undef
and $sessionid =~ s/\0.*//s;
@@ -1262,7 +1262,7 @@
$Vend::CookieID = $Vend::Cookie = 1;
}
- $0 = "interchange: $Vend::Cat $CGI::host $sessionid";
+ Vend::Server::set_process_name("$Vend::Cat $CGI::host $sessionid");
$::Instance->{CookieName} = 'MV_SESSION_ID' if ! $::Instance->{CookieName};
@@ -1462,7 +1462,7 @@
$Vend::Session->{'user'} = $CGI::user;
- $0 = "interchange: $Vend::Cat $CGI::host $sessionid " . $Vend::Session->{username} || '-';
+ Vend::Server::set_process_name("$Vend::Cat $CGI::host $sessionid " . $Vend::Session->{username} || '-');
$CGI::pragma = 'no-cache'
if delete $::Scratch->{mv_no_cache};
@@ -1478,12 +1478,12 @@
if delete $Vend::Session->{one_time_path_alias}{$Vend::FinalPath};
}
- url_history($Vend::FinalPath) if $Vend::Cfg->{History};
+ url_history($Vend::FinalPath) if $Vend::Cfg->{History};
- $0 = "interchange: $Vend::Cat $CGI::host $sessionid " . ($Vend::Session->{username} || '-') . " $Vend::FinalPath";
+ Vend::Server::set_process_name("$Vend::Cat $CGI::host $sessionid " . ($Vend::Session->{username} || '-') . " $Vend::FinalPath");
# TRACK
- $Vend::Track = new Vend::Track
+ $Vend::Track = new Vend::Track
if $Vend::Cfg->{UserTrack} and not ($Vend::admin and ! $::Variable->{MV_TRACK_ADMIN});
# END TRACK
@@ -1712,7 +1712,7 @@
close_cat();
- $0 = 'interchange: done';
+ Vend::Server::set_process_name('done');
undef $H;
2.80 +46 -23 interchange/lib/Vend/Server.pm
rev 2.80, prev_rev 2.79
Index: Server.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.79
retrieving revision 2.80
diff -u -r2.79 -r2.80
--- Server.pm 10 Aug 2007 16:59:25 -0000 2.79
+++ Server.pm 12 Aug 2007 07:00:43 -0000 2.80
@@ -1,6 +1,6 @@
# Vend::Server - Listen for Interchange CGI requests as a background server
#
-# $Id: Server.pm,v 2.79 2007/08/10 16:59:25 jon Exp $
+# $Id: Server.pm,v 2.80 2007/08/12 07:00:43 pajamian Exp $
#
# Copyright (C) 2002-2007 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -26,7 +26,7 @@
package Vend::Server;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.79 $, 10);
+$VERSION = substr(q$Revision: 2.80 $, 10);
use Cwd;
use POSIX qw(setsid strftime);
@@ -872,40 +872,40 @@
sub connection {
my (%env, $entity);
- my $show_in_ps = shift;
+ my $show_in_ps = shift;
- $0 = 'interchange: connection';
+ set_process_name('connection');
- ### This resets all $Vend::variable settings so we start
- ### completely initialized. It only affects the Vend package,
- ### not any Vend::XXX packages.
- reset_vars();
-
- if($Global::ShowTimes) {
- @Vend::Times = times();
- ::logDebug ("begin connection. Summary time set to zero");
- }
+ ### This resets all $Vend::variable settings so we start
+ ### completely initialized. It only affects the Vend package,
+ ### not any Vend::XXX packages.
+ reset_vars();
+
+ if($Global::ShowTimes) {
+ @Vend::Times = times();
+ ::logDebug ("begin connection. Summary time set to zero");
+ }
read_cgi_data(\@Global::argv, \%env, \$entity)
or return 0;
show_times('end cgi read') if $Global::ShowTimes;
my $http = new Vend::Server \*MESSAGE, \%env, \$entity;
- # Can log all CGI inputs
- log_http_data($http) if $Global::Logging;
+ # Can log all CGI inputs
+ log_http_data($http) if $Global::Logging;
- $0 = 'interchange: dispatch';
+ set_process_name('dispatch');
- show_times("begin dispatch") if $Global::ShowTimes;
+ show_times("begin dispatch") if $Global::ShowTimes;
::dispatch($http) if $http;
- show_times("end connection") if $Global::ShowTimes;
- close $http->{rfh} if $http->{rfh};
- undef $Vend::Cfg;
+ show_times("end connection") if $Global::ShowTimes;
+ close $http->{rfh} if $http->{rfh};
+ undef $Vend::Cfg;
- my $display = 'interchange: done';
- $display .= "($show_in_ps)" if $show_in_ps;
+ my $display = 'done';
+ $display .= "($show_in_ps)" if $show_in_ps;
- $0 = $display;
+ set_process_name($display);
}
## Signals
@@ -2990,6 +2990,29 @@
}
}
}
+}
+
+# Set the process name ($0) according to MV_DOLLAR_ZERO and a status indicator.
+sub set_process_name {
+ my $status = shift;
+ my $base = $Global::Variable->{MV_DOLLAR_ZERO};
+
+ # BSD hack which allows us to set MV_DOLLAR_ZERO to '0' to prevent Interchange
+ # from changing it (and dumping core on FreeBSD 4 stock perl).
+ return if defined $base && $base eq '0';
+
+ # Setting MV_DOLLAR_ZERO to 1 should do the same thing as not setting it for
+ # backwards compatibility.
+ $base = 'interchange' if !$base or $base eq '1';
+
+ if (defined $status) {
+ $0 = "$base: $status";
+ }
+ else {
+ $0 = $base;
+ }
+
+ return;
}
2.97 +8 -20 interchange/scripts/interchange.PL
rev 2.97, prev_rev 2.96
Index: interchange.PL
===================================================================
RCS file: /var/cvs/interchange/scripts/interchange.PL,v
retrieving revision 2.96
retrieving revision 2.97
diff -u -r2.96 -r2.97
--- interchange.PL 9 Aug 2007 13:40:57 -0000 2.96
+++ interchange.PL 12 Aug 2007 07:00:43 -0000 2.97
@@ -3,7 +3,7 @@
#
# Interchange version 5.5.0
#
-# $Id: interchange.PL,v 2.96 2007/08/09 13:40:57 pajamian Exp $
+# $Id: interchange.PL,v 2.97 2007/08/12 07:00:43 pajamian Exp $
#
# Copyright (C) 2002-2007 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -957,30 +957,18 @@
# Set $0 to something pretty for ps(1).
# Won't work on Solaris and IRIX among possibly others.
# Dumps core on FreeBSD 4 stock Perl build.
- if (defined $Global::Variable->{MV_DOLLAR_ZERO}) {
- if ($Global::Variable->{MV_DOLLAR_ZERO}) {
- if (length($Global::Variable->{MV_DOLLAR_ZERO}) > 1) {
- $0 = $Global::Variable->{MV_DOLLAR_ZERO};
- }
- else {
- $0 = "interchange --> $Global::VendRoot";
- }
- }
- # do nothing if MV_DOLLAR_ZERO is defined but false
- }
- else {
- $0 = 'interchange';
- }
+ # This is all done in Vend::Server::set_process_name now.
+ Vend::Server::set_process_name($Global::VendRoot);
# We won't have much output on any of this, but if we get some
# we want it immediately
- select STDERR;
- $| = 1;
- select STDOUT;
- $| = 1;
+ select STDERR;
+ $| = 1;
+ select STDOUT;
+ $| = 1;
# This should never return unless killed or a catastrophic error
- Vend::Server::run_server();
+ Vend::Server::run_server();
}
elsif($Vend::mode eq 'test') {
# Blank by design, this option only tests config files
More information about the interchange-cvs
mailing list