/******************************************************************************* * Copyright (c) 2007, Perforce Software, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE * SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. *******************************************************************************/ #define NEED_SIGNAL #define NEED_GETUID #define NEED_GETPWUID #define NEED_FORK #define NEED_TYPES #define NEED_STAT #include <errno.h> #include <grp.h> #include <clientapi.h> #include <vararray.h> #include <strtable.h> #include <error.h> #include <errorlog.h> #include <debug.h> #include "p4dctlerr.h" #include "parsesupp.h" #include "cmdline.h" #include "config.h" #include "varlist.h" #include "server.h" #include "p4ui.h" #include "p4dctldebug.h" // // Declare environ. It may already be declared, but it does no harm to // make sure it's there as not all platforms do so (Solaris, FreeBSD // at least). // extern char **environ; // // Special exit statuses from our children. // enum { CHILD_SUCCESS, CHILD_FAIL, CHILD_EXEC_FAIL, }; //------------------------------------------------------------------------------ // Server class implementation //------------------------------------------------------------------------------ // Server::Server( const char *name, int type, VarList *env, const Config *config ) { this->name = name; this->env = env; this->owner_uid = 0; this->owner_gid = 0; this->global_config = config; this->type = type; this->label = "(unknown)"; this->umask = 022; // // Extract the owner, binary and umask from the configuration and store // them separately // StrPtr *s; if( s = env->GetVar( "Execute" ) ) { this->binary = *s; env->DeleteVar( "Execute" ); } if( s = env->GetVar( "Owner" ) ) { this->owner = *s; env->DeleteVar( "Owner" ); } if( s = env->GetVar( "Umask" ) ) { this->umask = strtol( s->Text(), 0, 8 ); env->DeleteVar( "Umask" ); } if( s = env->GetVar( "Args" ) ) { this->args = *s; env->DeleteVar( "Args" ); } } Server::~Server() { delete env; } // // Check that the current user has the right to work with // this server // int Server::CheckAccess( Error *e ) { if( ! owner_uid ) LoadUserData( e ); if( e->Test() ) return CHECK_FAILED; // Get our own UID uid_t uid = getuid(); // // If we're root, we can run as anyone. If we're not root, we // can only work with our own servers. No-one can work with a server that // runs as root. // if( uid != 0 && uid != owner_uid ) { e->Set( CtlErr::ServerAccessDenied ) << name << label << owner; return CHECK_DENIED; } else if( owner_uid == 0 ) { e->Set( CtlErr::NoRootServers ) << name << owner; return CHECK_DENIED_ROOT; } // Otherwise, access is granted return CHECK_GRANTED; } // // Exec the binary to start the server. Returns non-zero if the server is // started. // int Server::Start( Error *e ) { pid_t pid; StrBuf procName; if( Running( e ) ) { e->Set( CtlErr::AlreadyRunning ) << name << label; return 1; } SetProcessName( procName ); CmdLine cmdline( procName ); ExtractArgs( cmdline ); if( !RunCommand( binary.Text(), &cmdline, pid, 1, 1, e ) ) return 0; // Save pid. SavePid( pid, e ); return 1; } // // Shut down the running server. Returns non-zero on error // int Server::Stop( Error *e ) { pid_t pid; // Attempt to stop it using the pidfile if( pid = LoadPid( e ) ) { // Whether this works or not, we'll remove the pid file. CleanPid(); if( kill( pid, SIGTERM ) < 0 ) return 0; return 1; } e->Clear(); return 0; } // // Check the status of the server. Returns non-zero if the server is alive // int Server::Running( Error *e ) { pid_t pid; pid = LoadPid( e ); e->Clear(); if( !pid ) return 0; if( kill( pid, 0 ) < 0 ) return 0; return 1; } // Debugging void Server::Dump() { Error e; LoadUserData( &e ); printf( "Name: %s(%s)\n", name.Text(), label.Text() ); printf( " Owner: %s\n", owner.Text() ); printf( " Owner uid: %d\n", owner_uid ); printf( " Owner gid: %d\n", owner_gid ); printf( " Owner home: %s\n", owner_home.Text() ); printf( " Umask: %#o\n", this->umask ); printf( " Binary: %s\n", binary.Text() ); printf( " Args: %s\n", args.Text() ); if ( (type == SERVER_P4D) && (((P4D *)this)->prefix.Length() > 0) ) printf( " Prefix: %s\n", ((P4D *)this)->prefix.Text() ); if ( (type == SERVER_P4D) && (((P4D *)this)->compress) ) printf( " Compress: true\n" ); printf( " Environment\n" ); env->Dump(); } int Server::Debug() { return global_config->Debug(); } // // Compute pid file path for this server // void Server::PidFile( StrBuf &buf ) { buf = global_config->PidDir(); buf << "/" << label << "." << name << ".pid"; } // // Write pid file // void Server::SavePid( pid_t pid, Error *e ) { StrBuf pidfile; StrBuf pidbuf; PidFile( pidfile ); pidbuf << pid << "\n"; FileSys *f = FileSys::Create( FST_TEXT ); f->Set( pidfile ); // // We need to be root to write pid files. // Config::RestorePrivs( e ); if( e->Test() ) return; // Open the file f->Open( FOM_WRITE, e ); if( !e->Test() ) { f->Write( pidbuf, e ); f->Close( e ); } // Lose the privs, we no longer need them. Config::DropPrivs( e ); delete f; } // // Load pid from file // pid_t Server::LoadPid( Error *e ) { StrBuf pidfile; StrBuf pidbuf; pid_t pid = 0; PidFile( pidfile ); FileSys *f = FileSys::Create( FST_TEXT ); f->Set( pidfile ); Config::RestorePrivs( e ); // Open the file f->Open( FOM_READ, e ); if( !e->Test() ) { if( f->ReadLine( &pidbuf, e ) ) pid = pidbuf.Atoi(); f->Close( e ); } Config::DropPrivs( e ); delete f; return pid; } // // Remove pid file // void Server::CleanPid() { Error e; StrBuf pidfile; PidFile( pidfile ); FileSys *f = FileSys::Create( FST_TEXT ); f->Set( pidfile ); Config::RestorePrivs( &e ); f->Unlink(); Config::DropPrivs( &e ); delete f; } void Server::LoadUserData( Error *e ) { struct passwd * pw; if( !owner.Length() ) { e->Set( CtlErr::MissingRequiredParm ) << name << label << "Owner"; return; } if( !( pw = getpwnam( owner.Text() ) ) ) { e->Sys( "getpwnam", owner.Text() ); return; } owner = pw->pw_name; owner_uid = pw->pw_uid; owner_gid = pw->pw_gid; owner_home = pw->pw_dir; owner_shell = pw->pw_shell; } pid_t Server::CreateChild( int daemon, int silent, Error *e ) { pid_t pid; switch( pid = fork() ) { case -1: e->Sys( "fork", "" ); return pid; case 0: // Child break; default: // parent return pid; } // child continues // Set up the child's environment. This leaks a little, but the child // will soon exit or exec() so it doesn't matter. VarArray *childEnv = new VarArray; VarList ce; // Set Standard variables first ce.SetVar( "HOME", owner_home.Text() ); ce.SetVar( "SHELL", owner_shell.Text() ); ce.SetVar( "USER", owner.Text() ); ce.SetVar( "LOGNAME", owner.Text() ); // Now merge in the global, and local environment lists together getting // rid of any dups. ce.Import( global_config->GetEnv() ); // Then global ce.Import( env ); // Then server specific // Now build the new environ pointer ce.Export( childEnv ); // Transfer to VarArray childEnv->Put( 0 ); // Terminate! environ = (char **) childEnv->ElemTab(); // // Now the next step is to become the relevant user. To do that, we'll // first need our privileges back temporarily. // Config::RestorePrivs( e ); if( e->Test() ) { AssertLog.Report( e ); exit( CHILD_FAIL ); } if( initgroups( owner.Text(), owner_gid ) < 0 ) { e->Sys( "initgroups", owner.Text() ); AssertLog.Report( e ); exit( CHILD_FAIL ); } if( setgid( owner_gid ) < 0 ) { e->Sys( "setgid", owner.Text() ); AssertLog.Report( e ); exit( CHILD_FAIL ); } if( setuid( owner_uid ) < 0 ) { e->Sys( "setuid", owner.Text() ); AssertLog.Report( e ); exit( CHILD_FAIL ); } // // Now set the umask // if( Debug() ) printf( "Setting umask to: %#o\n", this->umask ); ::umask( this->umask ); // // Change directory to owner's home. Must happen after we've become the owner // if( chdir( owner_home.Text() ) < 0 ) { e->Sys( "chdir", owner_home.Text() ); AssertLog.Report( e ); exit( CHILD_FAIL ); } // Dump the output unless explicitly requested, or debugging. if( silent && !Debug() ) { FILE *t; // to squelch compiler gripes. t = freopen( "/dev/null", "r", stdin ); t = freopen( "/dev/null", "w", stdout ); t = freopen( "/dev/null", "w", stderr ); } for( int i = 3; i < 256; i++ ) close( i ); // // If they want a daemon, we now detach from the controlling terminal // if( daemon ) setsid(); return 0; } // // Returns to Parent: // 0 on error // 1 on success // // Sets pid to the pid of the child process. // int Server::RunCommand( const char *cmd, CmdLine *args, pid_t &pid, int daemon, int silent, Error *e ) { int status; StrBuf cmdStr; // // Format the command line into a buffer // args->Fmt( cmd, cmdStr ); switch( pid = CreateChild( daemon, silent, e ) ) { case -1: return 0; case 0: break; default: // Parent - if we're not starting a daemon, then reap the exit // status of the child. If we are starting a daemon, then we'll // wait 1 second for the child's exec to potentially fail. In this // way we hope to be more accurate with error reporting. // int waitopts = 0; if( daemon ) { sleep( 1 ); waitopts = WNOHANG; } switch( waitpid( pid, &status, waitopts ) ) { case -1: e->Sys( "waitpid", "" ); return 0; case 0: // child has not yet exited. Cool! return 1; default: // Whoops. Child died on us. break; } if( WIFSIGNALED( status ) ) { e->Set( CtlErr::ChildKilled ) << pid << WTERMSIG( status ); return 0; } if( WEXITSTATUS( status ) ) { if( WEXITSTATUS( status ) == CHILD_EXEC_FAIL ) e->Set( CtlErr::ChildExecFail ) << cmdStr; else e->Set( CtlErr::ChildFailed ) << cmdStr << WEXITSTATUS(status); return 0; } return 1; } // Child now exec's if( DEBUG_CMDS ) printf( "Executing: \"%s\"\n", cmdStr.Text() ); execvp( cmd, args->Argv() ); // Whoops! e->Sys( "exec()", cmdStr.Text() ); exit( CHILD_EXEC_FAIL ); } void Server::ExtractArgs( CmdLine &cmdline ) { StrBuf t; int i; char * b; char * e; for( b = e = args.Text(); b; ) { switch( *e ) { case ' ': t.Set( b, e - b ); cmdline.Arg( t.Text() ); b = ++e; break; case 0: t.Set( b, e - b ); if( t.Length() ) cmdline.Arg( t.Text() ); return; default: e++; } } } // // Run a Perforce command: we run this in a subprocess to ensure that the // environment is 100% correct. // int Server::RunP4Command( const char *cmd, CmdLine &c, Error *e ) { pid_t pid; int status; StrBuf cmdStr; // // Format the command line into a buffer // c.Fmt( cmd, cmdStr ); switch( pid = CreateChild( 0, 1, e ) ) { case -1: e->Sys( "fork", "" ); return 0; case 0: // Child break; default: // parent if( waitpid( pid, &status, 0 ) < 0 ) { e->Sys( "waitpid", "" ); return 0; } if( WIFSIGNALED( status ) ) { e->Set( CtlErr::ChildKilled ) << pid << WTERMSIG( status ); return 0; } // // What we return now is 1 if the command ran successfully // and 0 if there was an error return !WEXITSTATUS( status ); } // Child now runs the Perforce command if( DEBUG_CMDS ) printf( "Running: \"p4 %s\"\n", cmdStr.Text() ); ClientApi client; P4UI ui; StrPtr * port; port = env->GetVar( "P4PORT" ); client.SetPort( port ); client.Init( e ); if( e->Test() ) exit( 1 ); if( c.Count() ) client.SetArgv( c.Count(), c.Argv() ); client.Run( cmd, &ui ); client.Final( e ); printf( "Perforce command done\n" ); if( !ui.Success() ) ui.GetErrors( e ); exit( e->Test() ); } //------------------------------------------------------------------------------ // P4D class implementation //------------------------------------------------------------------------------ P4D::P4D( const char *name, VarList *env, const Config *config ) : Server( name, SERVER_P4D, env, config ) { StrPtr *s; label = "p4d"; prefix = ""; if( s = env->GetVar( "Prefix" ) ) { prefix = *s; env->DeleteVar( "Prefix" ); } } // // Check the server's configuration // int P4D::IsValid( Error *e ) { if( !binary.Length() && !env->GetVar( "Execute" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Execute" ; else if( !owner.Length() && !env->GetVar( "Owner" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Owner" ; else if( !env->GetVar( "P4ROOT" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4ROOT" ; else if( !env->GetVar( "P4PORT" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4PORT" ; else if( !env->GetVar( "PATH" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "PATH" ; return !e->Test(); } // // Set the process name for P4D servers // void P4D::SetProcessName( StrBuf &processName ) { StrPtr * port; port = env->GetVar( "P4PORT" ); processName << "p4d [" << name << "/" << *port << "]"; } // // Shut down the running server. Returns non-zero on error // int P4D::Stop( Error *e ) { StrPtr * port; pid_t pid; CmdLine cmdline; cmdline.Arg( "stop" ); if( RunP4Command( "admin", cmdline, e ) ) { CleanPid(); return 1; } e->Clear(); if( DEBUG_CMDS ) { e->Set( CtlErr::KillingServer ) << name << label; AssertLog.ReportNoTag( e ); e->Clear(); } return Server::Stop( e ); } // // Check the status of the server. Returns non-zero if the server is alive // int P4D::Running( Error *e ) { CmdLine cmdline; if( !RunP4Command( "info", cmdline, e ) ) { e->Clear(); return 0; } return 1; } // // Take a checkpoint using 'p4d -jc'. Not interested in doing this // via 'p4 admin checkpoint' since (a) we want to be able to do this // with the server shut down, and (b) we need the exit status from // the server. // void P4D::Checkpoint( Error *e ) { CmdLine cmdline( binary ); StrBuf t; pid_t pid; ExtractArgs( cmdline ); cmdline.Arg("-jc"); if( this->compress ) cmdline.Arg( "-z" ); if( prefix.Length() ) cmdline.Arg( prefix.Text() ); RunCommand( binary.Text(), &cmdline, pid, 0, 1, e ); if( e->Test() ) e->Set( CtlErr::CheckpointFail ) << name; } // // Rotate the journal using 'p4d -jj' // void P4D::RotateJournal( Error *e ) { CmdLine cmdline( binary ); StrBuf t; pid_t pid; ExtractArgs( cmdline ); if( this->compress ) cmdline.Arg( "-z" ); cmdline.Arg( "-jj" ); if ( this->prefix.Length() > 0 ) cmdline.Arg( this->prefix.Text() ); if( prefix.Length() ) cmdline.Arg( prefix.Text() ); RunCommand( binary.Text(), &cmdline, pid, 0, 1, e ); if( e->Test() ) e->Set( CtlErr::RotateFail ) << name; } //------------------------------------------------------------------------------ // P4P class implementation //------------------------------------------------------------------------------ // // Check the server's configuration // int P4P::IsValid( Error *e ) { if( !binary.Length() && !env->GetVar( "Execute" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Execute" ; else if( !owner.Length() && !env->GetVar( "Owner" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Owner" ; else if( !env->GetVar( "P4PORT" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4PORT" ; else if( !env->GetVar( "P4TARGET" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4TARGET" ; else if( !env->GetVar( "P4PCACHE" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4PCACHE" ; else if( !env->GetVar( "PATH" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "PATH" ; return !e->Test(); } // // Set the process name for P4P servers // void P4P::SetProcessName( StrBuf &processName ) { StrPtr * port; port = env->GetVar( "P4PORT" ); processName << "p4p [" << name << "/" << *port << "]"; } // // Check the status of the server. Returns non-zero if the server is alive. // We can use 'p4 info' for this. // int P4P::Running( Error *e ) { StrPtr * port; pid_t pid; port = env->GetVar( "P4PORT" ); CmdLine cmdline; if( !RunP4Command( "info", cmdline, e ) ) { // p4 info failed. That doesn't necessarily mean the proxy isn't // running though. It might mean the p4d or network link is // down. e->Clear(); return Server::Running( e ); } return 1; } //------------------------------------------------------------------------------ // P4Web class implementation //------------------------------------------------------------------------------ // // Check the server's configuration // int P4Web::IsValid( Error *e ) { if( !binary.Length() && !env->GetVar( "Execute" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Execute" ; else if( !owner.Length() && !env->GetVar( "Owner" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Owner" ; else if( !env->GetVar( "P4PORT" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4PORT" ; else if( !env->GetVar( "P4WEBPORT" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4WEBPORT" ; return !e->Test(); } // // Set the process name for P4Web servers // void P4Web::SetProcessName( StrBuf &processName ) { StrPtr * port; port = env->GetVar( "P4WEBPORT" ); processName << "p4web [" << name << "/" << *port << "]"; } //------------------------------------------------------------------------------ // P4FTP class implementation //------------------------------------------------------------------------------ // // Start P4FTP. If the P4FTPPORT is < 1024, then we'll need to be root // to open the listen address so we need to start it as root and // add the -u flag to the command line args. // int P4Ftp::Start( Error *e ) { if( !IsValid( e ) ) return 1; StrPtr *port = env->GetVar( "P4FTPPORT" ); // If it's a non-privileged port, just call super-class implementation // and return if( port->Atoi() > 1023 ) return Server::Start( e ); // // Trying to listen on a priv'd port (probably 21). Append "-u owner" // to command line, and start it up as root. We have to reload the // user data now that the owner's changed, and then we start her up. // args.Append( "-u " ); args << owner; owner = "root"; LoadUserData( e ); return Server::Start( e ); } // // Check the server's configuration // int P4Ftp::IsValid( Error *e ) { if( !binary.Length() && !env->GetVar( "Execute" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Execute" ; else if( !owner.Length() && !env->GetVar( "Owner" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Owner" ; else if( !env->GetVar( "P4PORT" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4PORT" ; else if( !env->GetVar( "P4FTPPORT" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4FTPPORT" ; return !e->Test(); } // // Set the process name for P4Ftp servers // void P4Ftp::SetProcessName( StrBuf &processName ) { StrPtr * port; port = env->GetVar( "P4FTPPORT" ); processName << "p4ftpd [" << name << "/" << *port << "]"; } //------------------------------------------------------------------------------ // P4Broker class implementation //------------------------------------------------------------------------------ // // Check the server's configuration // int P4Broker::IsValid( Error *e ) { if( !binary.Length() && !env->GetVar( "Execute" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Execute" ; else if( !owner.Length() && !env->GetVar( "Owner" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Owner" ; else if( !env->GetVar( "P4BROKEROPTIONS" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "P4BROKEROPTIONS" ; return !e->Test(); } // // Set the process name for P4Ftp servers // void P4Broker::SetProcessName( StrBuf &processName ) { processName << "p4broker [" << name << "]"; } //------------------------------------------------------------------------------ // OtherServer class implementation //------------------------------------------------------------------------------ OtherServer::OtherServer( const char *name, VarList *env, const Config *config ) : Server( name, SERVER_OTHER, env, config ) { label = "other"; StrPtr *s; if( s = env->GetVar( "Port" ) ) { port = *s; env->DeleteVar( "Port" ); } } // // Check the server's configuration // int OtherServer::IsValid( Error *e ) { if( !binary.Length() && !env->GetVar( "Execute" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Execute" ; else if( !owner.Length() && !env->GetVar( "Owner" ) ) e->Set( CtlErr::MissingRequiredParm ) << name << label << "Owner" ; return !e->Test(); } // // Set the process name for other servers // void OtherServer::SetProcessName( StrBuf &processName ) { processName << binary << " [" << name; if( port.Length() ) processName << "/" << port; processName << "]"; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 8069 | Mark Allender | Merged Tony Smith's changes. | ||
#2 | 7585 | Mark Allender |
Added support for the following: - 'Args' value specified in a p4d server block is now also applied to checkpoint and journal file calls. I specifically added this for flags like -C1, which while technically unsupported, is also required on all calls to p4d. I wasn't sure that there were any flags which would be used when starting a server and not when checkpointing (since all other required values are specified as environement variables) - support for checkpoint/journal prefix. Using the 'CkpPrefix =' in the p4d server block, you can specify a prefix used in checkpoints and journal rotations. Currently the same prefix is used for both. - support for specifying whether or not checkpoints and journal rotations should be compressed. Use the 'CkpCompres = true' in the p4d server block. ACtually, just the presence of this variable will enable compressed checkpoints. That probably ought to be changed. - Support for a 'dump' command from p4dctl. I wanted to be able to dump environment settings (specifically p4root, checkpoint prefixes and whether or not compression was used) in scripts that I was writing. I hijacked the Dump() command that was used in debug output. |
||
#1 | 7584 | Mark Allender | Initial checkin of p4dctl code in order to cleanly make other modifications (better support for compressed checkpoints, prefixes for checkpoints, etc) | ||
//guest/tony_smith/perforce/p4dctl/src/server.cpp | |||||
#6 | 7190 | Tony Smith |
Bug fix: Empty argument lists weren't handled correctly. This change fixes that |
||
#5 | 7184 | Tony Smith |
Fix bug that prevented globally defined environment variables from being overridden by local definitions. The diffs here are a little large because the most sensible way to do this was to switch to using dictionaries for building the environment vars (to make replacing values easy), and then convert them to a VarArray later in a format that can be used as an environ pointer. |
||
#4 | 7177 | Tony Smith |
Update p4dctl to build with 2008.2 API. No major changes needed, mostly jam stuff. The big change is to include all the rules from the sample Jamrules included in the Perforce API since that's the Jamrules used to build the API. This ensures that we're using the right compiler/linker flags on every platform. I also made sure that when lex & yacc are installed, and the grammar is compiled as part of the build, that the source tree is updated with the pre-compiled grammar. Makes it easy to maintain. Lastly, I updated the binary while I was there. |
||
#3 | 6285 | Tony Smith |
Add support for starting arbitrary daemons through this framework using configuration entries like this: other <name> { Execute = <binary> Owner = <username> [ Port = <listen port (if any)> ] [ Umask = <umask> ] PATH = "/usr/bin: etc. etc." } |
||
#2 | 6152 | Tony Smith |
Add support for configuring the umask with which Perforce services should run to p4dctl. If unspecified, the default umask is 022. |
||
#1 | 5945 | Tony Smith |
Release p4dctl, a program for starting/stopping Perforce services on Unix operating systems. Similar to, and developed in concert with, Sven Erik Knop's p4dcfg. For example: p4dctl start -a Can start multiple P4D, P4P, P4Web, or P4FTP servers in one easy command line. It can be executed by root, or by the 'owners' of the configured services and it maintains pidfiles no matter who uses it (so they remain accurate). An init script using p4dctl will typically just use: p4dctl start -a p4dctl stop -a p4dctl restart -a And check the exit status. |