http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/tclog.cxx ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/tclog.cxx b/core/sqf/monitor/linux/tclog.cxx deleted file mode 100644 index 0aa3feb..0000000 --- a/core/sqf/monitor/linux/tclog.cxx +++ /dev/null @@ -1,121 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// @@@ START COPYRIGHT @@@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// @@@ END COPYRIGHT @@@ -// -/////////////////////////////////////////////////////////////////////////////// - -//#include <iostream> - -using namespace std; - -#include <assert.h> -#include <pthread.h> -#include <time.h> -#include <sys/time.h> -#include <sys/types.h> -#include <unistd.h> -#include <linux/unistd.h> -#include "tctrace.h" -#include "tclog.h" - -#define gettid() syscall(__NR_gettid) - -pthread_mutex_t TcLogMutex = PTHREAD_MUTEX_INITIALIZER; - -const char *LogLevelStr( int severity ) -{ - const char *str; - - switch (severity) - { - case TC_LOG_EMERG: - str = "FATAL"; - break; - case TC_LOG_ALERT: - str = "WARN"; - break; - case TC_LOG_CRIT: - str = "FATAL"; - break; - case TC_LOG_ERR: - str = "ERROR"; - break; - case TC_LOG_WARNING: - str = "WARN"; - break; - case TC_LOG_NOTICE: - str = "INFO"; - break; - case TC_LOG_INFO: - str = "INFO"; - break; - case TC_LOG_DEBUG: - str = "DEBUG"; - break; - default: - str = "INFO"; - } - - return( str ); -} - -int TcLogWrite(int eventType, int severity, char *msg) -{ - int status; - - char eventTimeFmt[20]; - struct timeval eventTime; - - status = pthread_mutex_lock(&TcLogMutex); - assert(status == 0); - - gettimeofday(&eventTime, NULL); - struct tm *ltime = localtime(&eventTime.tv_sec); - sprintf( eventTimeFmt - , "%04d-%02d-%02d %02d:%02d:%02d" - , ltime->tm_year+1900 - , ltime->tm_mon+1 - , ltime->tm_mday - , ltime->tm_hour - , ltime->tm_min - , ltime->tm_sec ); - - fprintf( stderr - , "%s,, %s, TRAFCONFIG,,, PIN: %u,,,, TID: %ld, Message ID: %d, %s\n" - , eventTimeFmt - , LogLevelStr(severity) - , getpid() - , gettid() - , eventType - , msg ); - - status = pthread_mutex_unlock(&TcLogMutex); - assert(status == 0); - - if (TcTraceSettings & TC_TRACE_LOG_MSG) - { - trace_printf("Log Event: %d, %s\n(%s)\n", - eventType, LogLevelStr(severity), msg); - } - - return(0); -}
http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/tclog.h ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/tclog.h b/core/sqf/monitor/linux/tclog.h deleted file mode 100644 index e9ec644..0000000 --- a/core/sqf/monitor/linux/tclog.h +++ /dev/null @@ -1,46 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// @@@ START COPYRIGHT @@@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// @@@ END COPYRIGHT @@@ -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef TCLOG_H_ -#define TCLOG_H_ - -#include "common/evl_sqlog_eventnum.h" - -using namespace std; - -#define TC_LOG_BUF_SIZE 256 - -#define TC_LOG_EMERG 0 /* system is unusable */ -#define TC_LOG_ALERT 1 /* action must be taken immediately */ -#define TC_LOG_CRIT 2 /* critical conditions */ -#define TC_LOG_ERR 3 /* error conditions */ -#define TC_LOG_WARNING 4 /* warning conditions */ -#define TC_LOG_NOTICE 5 /* normal but significant condition */ -#define TC_LOG_INFO 6 /* informational */ -#define TC_LOG_DEBUG 7 /* debug-level messages */ - -int TcLogWrite(int event_type, int severity, char *evl_buf); - -#endif /* TCLOG_H_ */ http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/tctrace.cxx ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/tctrace.cxx b/core/sqf/monitor/linux/tctrace.cxx deleted file mode 100644 index d3a0ff9..0000000 --- a/core/sqf/monitor/linux/tctrace.cxx +++ /dev/null @@ -1,366 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// @@@ START COPYRIGHT @@@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// @@@ END COPYRIGHT @@@ -// -/////////////////////////////////////////////////////////////////////////////// - -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <unistd.h> - -using namespace std; - -#include "tctrace.h" - -#define TC_PROCESS_PATH_MAX 256 - -const char *CTrafConfigTrace::strTraceEnable_ = "TC_TRACE_ENABLE"; -const char *CTrafConfigTrace::strTraceFile_ = "TC_TRACE_FILE"; -const char *CTrafConfigTrace::strTraceFileFb_ = "TC_TRACE_FILE_FB"; - -const CTrafConfigTrace::TraceArea_t CTrafConfigTrace::traceAreaList_[] = -{ - {"TC_TRACE_REQUEST", TC_TRACE_REQUEST}, - {"TC_TRACE_NODE", TC_TRACE_NODE}, - {"TC_TRACE_PERSIST", TC_TRACE_PERSIST}, - {"TC_TRACE_REGISTRY", TC_TRACE_REGISTRY}, - {"TC_TRACE_INIT", TC_TRACE_INIT}, - {"TC_TRACE_LOG_MSG", TC_TRACE_LOG_MSG}, - {"TC_TRACE_ENTRY_EXIT", TC_TRACE_ENTRY_EXIT} -}; - -// Global trace flags -long TcTraceSettings = 0; - -CTrafConfigTrace::CTrafConfigTrace() - : tracingEnabled_(false) - , traceSettingsSaved_(0) - , traceFileFb_(0) - , traceFileBase_(NULL) -{ - numTraceAreas_ = sizeof(traceAreaList_)/sizeof(TraceArea_t); -} - -const char *CTrafConfigTrace::GetEnvStr(const char *key) -{ - const char *value; - value = getenv(key); - return value; -} - -void CTrafConfigTrace::GetEnvInt(const char *key, int &val) -{ - const char *p = GetEnvStr(key); - if (p != NULL) - { - val = atoi(p); - } -} - -bool CTrafConfigTrace::GetEnvBool(const char *key) -{ - const char *p = GetEnvStr(key); - bool val = false; - if (p != NULL) - { - val = atoi(p); - } - return val; -} - -void CTrafConfigTrace::TraceClose( void ) -{ - trace_close(); -} - -void CTrafConfigTrace::TraceInit( bool traceEnabled - , const char *traceLevel - , const char *pfname) -{ - bool pathnameUsed = false; - char trace_file_name[TC_PROCESS_PATH_MAX]; - char hostname[TC_PROCESS_PATH_MAX]; - - tracingEnabled_ = traceEnabled; - - if (gethostname(hostname,sizeof(hostname)) == -1) - { - sprintf( hostname,"TC"); - } - - if (pfname == NULL) - { // Caller did not specify a trace file name, get name from - // environment variable if specified. - pfname = GetEnvStr(strTraceFile_); - } - - if (pfname == NULL) - { // Use default prefix - pfname = "tctrace"; - } - - if (pfname != NULL) - { // User specified trace file name - - if ( pfname[0] == '/') - { - // Use filename passed in - strcpy(trace_file_name, pfname); - pathnameUsed = true; - } - else - { - // Format default trace file name and remove any existing trace file. - if( getenv("SQ_VIRTUAL_NODES") ) - { - sprintf( trace_file_name,"%s/trafconfig.trace.%d.%s" - , getenv("MPI_TMPDIR") - , getpid() - , hostname); - } - else - { - sprintf( trace_file_name,"%s/trafconfig.trace.%s" - , getenv("MPI_TMPDIR") - , hostname); - } - - if ((strcmp(pfname, "STDOUT") == 0) - || strcmp(pfname, "STDERR") == 0) - { - strcpy(trace_file_name, pfname); - } - else // Make user specified file name unique per node - { - sprintf(trace_file_name,"%s/%s.%d.%s" - , getenv("MPI_TMPDIR") - , pfname - , getpid() - , hostname); - } - } - } - - if (!pathnameUsed) - { - remove(trace_file_name); - } - - // Get any trace settings that were specified via environment variables - const char *value; - - for (int i=0; i<numTraceAreas_; i++) - { - value = getenv(traceAreaList_[i].id); - if (value != NULL) - { - if (atoi(value) != 0) - // set the enabled flag for this trace area - TcTraceSettings |= traceAreaList_[i].bitFlag; - } - } - - if (!tracingEnabled_) - { - // Get environment variable specifying whether tracing is enabled - tracingEnabled_ = GetEnvBool(strTraceEnable_); - // Get environment variable value for trace buffer size if specified - GetEnvInt(strTraceFileFb_, traceFileFb_); - } - - // Convert the user specified trace level string to a number. The - // number can be specified as a decimal, octal or hexadecimal - // constant. Combine these flags with current TcTraceSettings that - // may have been set via environment variables. - long trace_flags; - trace_flags = strtol(traceLevel, NULL, 0); - if (errno != ERANGE) - { - TcTraceSettings |= trace_flags; - } - - // If any trace settings were specified initialize the trace file - if (TcTraceSettings != 0 || tracingEnabled_) - { - traceSettingsSaved_ = TcTraceSettings; - - if (pfname != NULL) - { - trace_init(trace_file_name, - false, // don't append pid to file name - pathnameUsed?(char*)"":(char*)"trafconfig", // file prefix - false); - if (traceFileFb_ > 0) - { - trace_set_mem(traceFileFb_); - } - } - } -} - - -void CTrafConfigTrace::TraceHelpBool( const char *key - , const char *value - , const char *key_cmp - , bool &value_ret ) -{ - if ((key != NULL) && (strcasecmp(key, key_cmp) == 0)) - { - value_ret = atoi(value); - } -} - -void CTrafConfigTrace::TraceHelpInt( const char *key - , const char *value - , const char *key_cmp - , int &value_ret ) -{ - if ((key != NULL) && (strcasecmp(key, key_cmp) == 0)) - { - value_ret = atoi(value); - } -} - -const char *CTrafConfigTrace::TraceHelpStr( const char *key - , const char *value - , const char *key_cmp ) -{ - if ((key != NULL) && (strcasecmp(key, key_cmp) == 0)) - { - return value; - } - return NULL; -} - - -void CTrafConfigTrace::TraceChange(const char *key, const char *value) -{ - bool trace_was_enabled = tracingEnabled_; - const char *pfname; - int old_fb = traceFileFb_; - - if (key == NULL) - return; - - // Restore saved trace settings in case trace flags get modified - TcTraceSettings = traceSettingsSaved_; - - // Compare the key with each of the trace flag strings. When - // there is an equal compare, assign the value to the appropriate flag. - for (int i=0; i<numTraceAreas_; i++) - { - if (strcasecmp(key, traceAreaList_[i].id) == 0) - { - if (atoi(value) != 0) - { - // set the enabled flag for this trace area - TcTraceSettings |= traceAreaList_[i].bitFlag; - } - else // clear the enabled flag for this trace area - { - TcTraceSettings &= ~traceAreaList_[i].bitFlag; - } - break; - } - } - // Save current trace settings - traceSettingsSaved_ = TcTraceSettings; - - - // Check if tracing is being enabled/disabled - TraceHelpBool(key, value, strTraceEnable_, tracingEnabled_); - // Check if trace file buffer size is being specified - TraceHelpInt(key, value, strTraceFileFb_, traceFileFb_); - - // Check if trace file base name is being specified - pfname = TraceHelpStr(key, value, strTraceFile_); - if (pfname != NULL) - { // Save trace file base name - delete [] traceFileBase_; - traceFileBase_ = new char[strlen(pfname) + 1]; - strcpy(traceFileBase_, pfname); - } - - if (!trace_was_enabled && tracingEnabled_) - { - char fname[TC_PROCESS_PATH_MAX]; - char hostname[TC_PROCESS_PATH_MAX]; - if (gethostname(hostname,sizeof(hostname)) == -1) - { - sprintf( hostname,"TC"); - } - - // Formulate trace file name - if (traceFileBase_ != NULL) - { // User specified trace file name - if ((strcmp(traceFileBase_, "STDOUT") == 0) - || strcmp(traceFileBase_, "STDERR") == 0) - { - strcpy(fname, traceFileBase_); - } - else - { // Make user specified file name unique per node - sprintf( fname,"%s/%s.%d.%s" - , getenv("MPI_TMPDIR") - , traceFileBase_ - , getpid() - , hostname); - } - } - else - { // No user specified trace file name, use default - if( getenv("SQ_VIRTUAL_NODES") ) - { - sprintf( fname,"%s/trafconfig.trace.%d.%s" - , getenv("MPI_TMPDIR") - , getpid() - , hostname); - } - else - { - sprintf( fname,"%s/trafconfig.trace.%s" - , getenv("MPI_TMPDIR") - , hostname); - } - } - - // Tracing was disabled and is now enabled, initialize trace - trace_init(fname, - false, // don't append pid to file name - hostname, // prefix - false); - } - if (trace_was_enabled && !tracingEnabled_) - { - // Tracing was enabled and now is disabled, flush trace. Save - // current trace settings. - trace_flush(); - - TcTraceSettings = 0; - } - - // If a new trace file buffer size was specified, set it - if ((traceFileFb_ > 0) && (old_fb != traceFileFb_)) - trace_set_mem(traceFileFb_); -} http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/tctrace.h ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/tctrace.h b/core/sqf/monitor/linux/tctrace.h deleted file mode 100644 index 66ff0f1..0000000 --- a/core/sqf/monitor/linux/tctrace.h +++ /dev/null @@ -1,103 +0,0 @@ -/********************************************************************** -// @@@ START COPYRIGHT @@@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// @@@ END COPYRIGHT @@@ -********************************************************************/ -#ifndef TCTRACE_H_ -#define TCTRACE_H_ - -#include "seabed/trace.h" - -// All request processing -#define TC_TRACE_REQUEST 0x00001 -// Node configuration processing -#define TC_TRACE_NODE 0x00002 -// Persist configuration processing -#define TC_TRACE_PERSIST 0x00004 -// Registry configuration processing -#define TC_TRACE_REGISTRY 0x00008 -// Initialization/shutdown information -#define TC_TRACE_INIT 0x00010 -// Event messages logged (error,informational,critical,etc.) -#define TC_TRACE_LOG_MSG 0x00020 -// Entry and exit from methods/functions -#define TC_TRACE_ENTRY_EXIT 0x00040 - -#define TRACE_ENTRY \ - if (TcTraceSettings & TC_TRACE_ENTRY_EXIT) trace_printf("%s@%d\n", method_name, __LINE__) - -#define TRACE_EXIT \ - if (TcTraceSettings & TC_TRACE_ENTRY_EXIT) trace_printf("%s@%d - Exit\n", method_name, __LINE__) - -extern long TcTraceSettings; - -class CTrafConfigTrace -{ -public: - CTrafConfigTrace(); - virtual ~CTrafConfigTrace() {} - - void TraceChange( const char *key, const char *value ); - void TraceClose( void ); - void TraceInit( bool traceEnabled - , const char *traceLevel - , const char *pfname); - -private: - - const char *GetEnvStr( const char *key ); - void GetEnvInt( const char *key, int &val ); - bool GetEnvBool( const char *key ); - void TraceHelpBool( const char *key - , const char *value - , const char *key_cmp - , bool &value_ret ); - void TraceHelpInt( const char *key - , const char *value - , const char *key_cmp - , int &value_ret ); - const char *TraceHelpStr( const char *key - , const char *value - , const char *key_cmp ); - - // The number of trace areas held in "traceAreaList" - int numTraceAreas_; - bool tracingEnabled_; - - // Save area for retaining prior trace settings if tracing is - // disabled. These are used to restore the values when tracing - // is re-enabled. - long traceSettingsSaved_; - - // Optional size of trace file buffer. - int traceFileFb_; - char *traceFileBase_; - - // Array of strings defining various trace areas and the - // trace bit flag associated with that area - typedef struct {const char *id; long bitFlag;} TraceArea_t; - static const TraceArea_t traceAreaList_[]; - - static const char *strTraceEnable_; - static const char *strTraceFile_; - static const char *strTraceFileFb_; -}; - -#endif /* TCTRACE_H_ */ http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/trafconf.cxx ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/trafconf.cxx b/core/sqf/monitor/linux/trafconf.cxx deleted file mode 100644 index c77d966..0000000 --- a/core/sqf/monitor/linux/trafconf.cxx +++ /dev/null @@ -1,631 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// @@@ START COPYRIGHT @@@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// @@@ END COPYRIGHT @@@ -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// File: trafconf.cxx -// -// Description: Trafodion configuration display utility program -// -/////////////////////////////////////////////////////////////////////////////// -using namespace std; - -#include <sched.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <mpi.h> - -#include "msgdef.h" -#include "montrace.h" -#include "sqevlog/evl_sqlog_writer.h" -#include "clusterconf.h" - -#define MAX_TOKEN 132 - -typedef enum { - TrafConfType_Undefined=0, // Invalid - TrafConfType_NodeName, // Display node names - TrafConfType_NodeName_w, // Display node names - TrafConfType_NodeId, // Display node ids - TrafConfType_PhysicalNodeId, // Display physical node ids - TrafConfType_ZoneId, // Display zone ids - // the above displays values as: "<value-1> <value-2> ..." - TrafConfType_NodeConfig, // Display all nodes configuration attributes - // node-id=0;node-name=n7;cores=0-1;processors=2;roles=connection,aggregation,storage - - TrafConfType_PersistConfig, // Display all persist configuration keys and attributes - - TrafConfType_PersistConfigKeys, // Display persist configuration keys - // PERSIST_PROCESS_KEYS = DTM,TMID,SSCP,SSMP,PSD,WDG,QMN - - TrafConfType_PersistConfigKey // Display persist configuration attributes of a 'key' - // { <persist-prefix>_PROCESS_NAME = {$<string><nid-format>} } - // [ <persist-prefix>_PROCESS_TYPE = {DTM|PERSIST|PSD|SSMP|TMID|WDG} ] - // { <persist-prefix>_PROGRAM_NAME = {<program-name>} } - // { <persist-prefix>_REQUIRES_DTM = {Y|N} } - // [ <persist-prefix>_STDOUT = {<file-name-prefix><nid-format>} ] - // { <persist-prefix>_PERSIST_RETRIES = {<retries> , <time-window-secs>} } - // { <persist-prefix>_PERSIST_ZONES = {<zid-format> [,<zid-format>] . . . } - -} TrafConfType_t; - -bool DisplayBeginEnd = false; // Valid only with: - // TrafConfType_NodeConfig - // TrafConfType_PersistConfig -bool DisplayShortHost = false; // Valid only with: - // TrafConfType_NodeName - // TrafConfType_NodeName_w - -char NodeName[MPI_MAX_PROCESSOR_NAME] = { 0 }; -char Key[MAX_TOKEN] = { 0 }; -TrafConfType_t TrafConfType = TrafConfType_Undefined; -CClusterConfig ClusterConfig; - -//char Node_name[MPI_MAX_PROCESSOR_NAME]; -//int MyPNID = -1; -long trace_settings = 0; - -const char *FormatNidString( FormatNid_t type ); -const char *FormatZidString( FormatZid_t type ); - -extern const char *PersistProcessTypeString( PROCESSTYPE type ); - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: mon_log_write() -// -// Description: Display event log message on terminal -// -// Usage: Invoked to display error message -// -/////////////////////////////////////////////////////////////////////////////// -int mon_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string) -{ - - pv_event_type = pv_event_type; - pv_severity = pv_severity; - int lv_err = 0; - - printf("%s", pp_string ); - - return lv_err; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: DisplayUsage() -// -// Description: Display usage help -// -// Usage: Invoked by main() when no option, -? option, -h option, -// or invalid options are used -// -/////////////////////////////////////////////////////////////////////////////// -void DisplayUsage( void ) -{ - fprintf( stderr, -"\nUsage: trafconf { -? | -h | -name | -nameshort | -wname | -wnameshort | -node | -persist }\n" -"\n Where:\n" -" -? Displays usage.\n" -" -h Displays usage.\n" -" -name Displays all node names in configuration.\n" -" - Name is as stored in configuration, which could be in short host name or FQDN form.\n" -" -short Displays all node names in configuration in short host name form.\n" -" -wname Displays all node names in configuration prefixed with '-w'\n" -" - Name is as stored in configuration, which could be in short host name or FQDN form.\n" -" -wshort Displays all node names in configuration short host name form prefixed with '-w'.\n" -" -node Displays node configuration (without begin/end brackets).\n" -" -persist Displays persist configuration (without begin/end brackets).\n\n" -" --node Displays node configuration (with begin/end brackets).\n" -" --persist Displays persist configuration (with begin/end brackets).\n\n" - ); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: RoleTypeString() -// -/////////////////////////////////////////////////////////////////////////////// -const char *RoleTypeString( ZoneType type ) -{ - const char *str; - - switch( type ) - { - case ZoneType_Edge: - str = "connection"; - break; - case ZoneType_Excluded: - str = "excluded"; - break; - case ZoneType_Aggregation: - str = "aggregation"; - break; - case ZoneType_Storage: - str = "storage"; - break; - case ZoneType_Frontend: - str = "connection,aggregation"; - break; - case ZoneType_Backend: - str = "aggregation,storage"; - break; - case ZoneType_Any: - str = "connection,aggregation,storage"; - break; - default: - str = "Undefined"; - break; - } - - return( str ); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: DisplayNodeAttributes() -// -/////////////////////////////////////////////////////////////////////////////// -void DisplayNodeAttributes( CLNodeConfig *lnodeConfig ) -{ - - char coresString[MAX_TOKEN]; - - if ( lnodeConfig ) - { - if (lnodeConfig->GetLastCore() == -1) - { - snprintf( coresString, sizeof(coresString) - , "%d", lnodeConfig->GetFirstCore() ); - } - else - { - snprintf( coresString, sizeof(coresString) - , "%d-%d" - , lnodeConfig->GetFirstCore() - , lnodeConfig->GetLastCore() ); - } - printf( "node-id=%d;node-name=%s;" - "cores=%s;processors=%d;roles=%s\n" - , lnodeConfig->GetNid() - , lnodeConfig->GetName() - , coresString - , lnodeConfig->GetProcessors() - , RoleTypeString( lnodeConfig->GetZoneType() ) - ); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: NodeNameStr() -// -/////////////////////////////////////////////////////////////////////////////// -const char *NodeNameStr( const char *name ) -{ - char *ptr = (char *)name; - - while ( ptr && *ptr && DisplayShortHost ) - { - if ( *ptr == '.' && DisplayShortHost ) - { - *ptr = '\0'; - break; - } - ptr++; - } - - return(name); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: DisplayNodeName() -// -/////////////////////////////////////////////////////////////////////////////// -void DisplayNodeName( CLNodeConfig *lnodeConfig, bool dashW ) -{ - if ( lnodeConfig ) - { - if ( dashW ) - { - printf( "-w " ); - } - printf( "%s ", NodeNameStr(lnodeConfig->GetName()) ); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: DisplayNodesConfig() -// -/////////////////////////////////////////////////////////////////////////////// -int DisplayNodeConfig( char *nodeName ) -{ - int rc = -1; - CLNodeConfig *lnodeConfig; - - lnodeConfig = ClusterConfig.GetFirstLNodeConfig(); - - if ( DisplayBeginEnd && TrafConfType == TrafConfType_NodeConfig ) - { - printf( "BEGIN NODE\n\n" ); - } - else if ( TrafConfType == TrafConfType_NodeConfig ) - { - printf( "\n" ); - } - - for ( ; lnodeConfig; lnodeConfig = lnodeConfig->GetNext() ) - { - if ( lnodeConfig ) - { - if ( *nodeName == '\0' - || (strcmp( nodeName, lnodeConfig->GetName()) == 0)) - { - switch (TrafConfType) - { - case TrafConfType_NodeConfig: - DisplayNodeAttributes( lnodeConfig ); - break; - case TrafConfType_NodeName: - DisplayNodeName( lnodeConfig, false ); - break; - case TrafConfType_NodeName_w: - DisplayNodeName( lnodeConfig, true ); - break; - default: - printf( "Invalid configuration type!\n" ); - } - rc = 0; - } - if (*nodeName != '\0' - && strcmp( nodeName, lnodeConfig->GetName()) == 0) - { - break; - } - } - } - - if ( DisplayBeginEnd && TrafConfType == TrafConfType_NodeConfig ) - { - printf( "\nEND NODE\n" ); - } - else if ( TrafConfType == TrafConfType_NodeConfig ) - { - printf( "\n" ); - } - - return(rc); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: DisplayPersistKeys() -// -/////////////////////////////////////////////////////////////////////////////// -int DisplayPersistKeys( void ) -{ - int rc = -1; - char persist_config_str[MAX_TOKEN]; - CPersistConfig *persistConfig; - - persistConfig = ClusterConfig.GetFirstPersistConfig(); - if (persistConfig) - { - snprintf( persist_config_str, sizeof(persist_config_str) - , "%s = ", PERSIST_PROCESS_KEYS ); - for ( ; persistConfig; persistConfig = persistConfig->GetNext() ) - { - strcat( persist_config_str, persistConfig->GetPersistPrefix() ); - if ( persistConfig->GetNext() ) - { - strcat( persist_config_str, "," ); - } - rc = 0; - } - printf ("%s\n\n", persist_config_str); - } - else - { - printf ("Configuration keys for persistent process do not exist\n"); - } - - return(rc); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: DisplayPersistConfig() -// -/////////////////////////////////////////////////////////////////////////////// -int DisplayPersistConfig( char *key ) -{ - int rc = -1; - bool foundConfig = false; - char persist_config_buf[TC_PERSIST_VALUE_MAX*2]; - char process_name_str[TC_PERSIST_VALUE_MAX]; - char process_type_str[TC_PERSIST_VALUE_MAX]; - char program_name_str[TC_PERSIST_VALUE_MAX]; - char program_args_str[TC_PERSIST_VALUE_MAX]; - char requires_dtm_str[TC_PERSIST_VALUE_MAX]; - char stdout_str[TC_PERSIST_VALUE_MAX]; - char persist_retries_str[TC_PERSIST_VALUE_MAX]; - char persist_zones_str[TC_PERSIST_VALUE_MAX]; - CPersistConfig *persistConfig; - - if ( DisplayBeginEnd ) - { - printf( "BEGIN PERSIST\n\n" ); - } - else - { - printf( "\n" ); - } - - if (*key == '\0') - { - DisplayPersistKeys(); - } - - persistConfig = ClusterConfig.GetFirstPersistConfig(); - if (persistConfig) - { - for ( ; persistConfig; persistConfig = persistConfig->GetNext() ) - { - if (*key == '\0' || - strcasecmp( key, persistConfig->GetPersistPrefix()) == 0) - { - foundConfig = true; - snprintf( process_name_str, sizeof(process_name_str) - , "%s_%s = %s%s" - , persistConfig->GetPersistPrefix() - , PERSIST_PROCESS_NAME_KEY - , persistConfig->GetProcessNamePrefix() - , persistConfig->GetProcessNameFormat() - ); - snprintf( process_type_str, sizeof(process_type_str) - , "%s_%s = %s" - , persistConfig->GetPersistPrefix() - , PERSIST_PROCESS_TYPE_KEY - , PersistProcessTypeString(persistConfig->GetProcessType()) - ); - snprintf( program_name_str, sizeof(program_name_str) - , "%s_%s = %s" - , persistConfig->GetPersistPrefix() - , PERSIST_PROGRAM_NAME_KEY - , persistConfig->GetProgramName() - ); - snprintf( program_args_str, sizeof(program_args_str) - , "%s_%s = %s" - , persistConfig->GetPersistPrefix() - , PERSIST_PROGRAM_ARGS_KEY - , strlen(persistConfig->GetProgramArgs()) - ?persistConfig->GetProgramArgs():"" - ); - snprintf( requires_dtm_str, sizeof(requires_dtm_str) - , "%s_%s = %s" - , persistConfig->GetPersistPrefix() - , PERSIST_REQUIRES_DTM - , persistConfig->GetRequiresDTM()?"Y":"N" - ); - snprintf( stdout_str, sizeof(stdout_str) - , "%s_%s = %s%s" - , persistConfig->GetPersistPrefix() - , PERSIST_STDOUT_KEY - , persistConfig->GetStdoutPrefix() - , persistConfig->GetStdoutFormat() - ); - snprintf( persist_retries_str, sizeof(persist_retries_str) - , "%s_%s = %d,%d" - , persistConfig->GetPersistPrefix() - , PERSIST_RETRIES_KEY - , persistConfig->GetPersistRetries() - , persistConfig->GetPersistWindow() - ); - snprintf( persist_zones_str, sizeof(persist_zones_str) - , "%s_%s = %s" - , persistConfig->GetPersistPrefix() - , PERSIST_ZONES_KEY - , persistConfig->GetZoneFormat() - ); - snprintf( persist_config_buf, sizeof(persist_config_buf) - , "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" - , process_name_str - , process_type_str - , program_name_str - , program_args_str - , requires_dtm_str - , stdout_str - , persist_retries_str - , persist_zones_str - ); - if (strcasecmp( key, persistConfig->GetPersistPrefix()) == 0) - { - printf ("%s", persist_config_buf); - break; - } - if (persistConfig->GetNext()) - { - printf ("%s\n", persist_config_buf); - } - else - { - printf ("%s", persist_config_buf); - } - rc = 0; - } - } - } - if (!foundConfig) - { - printf ("Persistent process configuration does not exist\n"); - } - - if ( DisplayBeginEnd ) - { - printf( "\nEND PERSIST\n" ); - } - else - { - printf( "\n" ); - } - - return(rc); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: ProcessTrafConfig() -// -/////////////////////////////////////////////////////////////////////////////// -int ProcessTrafConfig( void ) -{ - int rc = -1; - - switch (TrafConfType) - { - case TrafConfType_NodeConfig: - case TrafConfType_NodeName: - case TrafConfType_NodeName_w: - rc = DisplayNodeConfig( NodeName ); - break; - case TrafConfType_PersistConfig: - case TrafConfType_PersistConfigKeys: - case TrafConfType_PersistConfigKey: - rc = DisplayPersistConfig( Key ); - break; - case TrafConfType_NodeId: - case TrafConfType_PhysicalNodeId: - case TrafConfType_ZoneId: - default: - printf( "Not implemented, yet!\n" ); - } - - return( rc ); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function/Method: Program Main -// -/////////////////////////////////////////////////////////////////////////////// -int main( int argc, char *argv[] ) -{ - int error = 0; - - if ( argc == 1 ) - { - DisplayUsage(); - return 0; - } - - // Get required runtime options - for ( int argx = 1; argx < argc; argx++ ) - { - if ( strcmp( argv [argx], "-?" ) == 0 ) - { - DisplayUsage(); - return 0; - } - else if ( strcasecmp( argv [argx], "-h" ) == 0 ) - { - DisplayUsage(); - return 0; - } - else if ( strcasecmp( argv [argx], "-name" ) == 0 ) - { - TrafConfType = TrafConfType_NodeName; - } - else if ( strcasecmp( argv [argx], "-wname" ) == 0 ) - { - TrafConfType = TrafConfType_NodeName_w; - } - else if ( strcasecmp( argv [argx], "-short" ) == 0 ) - { - DisplayShortHost = true; - TrafConfType = TrafConfType_NodeName; - } - else if ( strcasecmp( argv [argx], "-wshort" ) == 0 ) - { - DisplayShortHost = true; - TrafConfType = TrafConfType_NodeName_w; - } - else if ( strcasecmp( argv [argx], "-node" ) == 0 ) - { - TrafConfType = TrafConfType_NodeConfig; - } - else if ( strcasecmp( argv [argx], "-persist" ) == 0 ) - { - TrafConfType = TrafConfType_PersistConfig; - } - else if ( strcasecmp( argv [argx], "--node" ) == 0 ) - { - DisplayBeginEnd = true; - TrafConfType = TrafConfType_NodeConfig; - } - else if ( strcasecmp( argv [argx], "--persist" ) == 0 ) - { - DisplayBeginEnd = true; - TrafConfType = TrafConfType_PersistConfig; - } - else - { - DisplayUsage(); - return 0; - } - } - - char *env; - env = getenv("TC_TRACE_ENABLE"); - if ( env && *env == '1' ) - { - trace_settings |= TRACE_TRAFCONFIG; - } - - if ( !ClusterConfig.Initialize() ) - { - printf( "Failed to initialize Trafodion Configuration!\n" ); - exit( EXIT_FAILURE ); - } - else - { - if ( !ClusterConfig.LoadConfig() ) - { - printf( "Failed to load Trafodion Configuration!\n" ); - exit( EXIT_FAILURE ); - } - } - - error = ProcessTrafConfig(); - if ( error ) - { - exit( EXIT_FAILURE ); - } - - exit( EXIT_SUCCESS ); -} http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/trafconfig.cxx ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/trafconfig.cxx b/core/sqf/monitor/linux/trafconfig.cxx deleted file mode 100644 index 5f9f95e..0000000 --- a/core/sqf/monitor/linux/trafconfig.cxx +++ /dev/null @@ -1,560 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// @@@ START COPYRIGHT @@@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// @@@ END COPYRIGHT @@@ -// -/////////////////////////////////////////////////////////////////////////////// - -using namespace std; - -#include "tcdb.h" -#include "tctrace.h" -#include "trafconfig.h" - -bool TcTraceEnabled = false; - -CTrafConfigTrace TrafConfigTrace; -CTcdb TrafConfigDb; - -/////////////////////////////////////////////////////////////////////////////// -// Trafodion Configuration -/////////////////////////////////////////////////////////////////////////////// - -TC_Export int tc_close( void ) -{ - int rc = TrafConfigDb.Close(); - - if (TcTraceEnabled) - { - TrafConfigTrace.TraceClose(); - } - - return( rc ); -} - -TC_Export const char *tc_errmsg( int err ) -{ - switch (err) - { - case TCSUCCESS: - return "Successful operation"; - case TCNOTIMPLEMENTED: - return "Not implemented"; - case TCNOTINIT: - return "Database not open"; - case TCALREADYINIT: - return "Database already opened"; - case TCDBOPERROR: - return "Database operation failed"; - case TCDBNOEXIST: - return "Database operation yielded non-existent data"; - case TCDBTRUNCATE: - return "Database operation returned less data than available"; - case TCDBCORRUPT: - return "Internal processing error or database corruption"; - default: - break; - } - return "Error undefined!"; -} - -TC_Export int tc_initialize( bool traceEnabled, const char *traceFileName ) -{ - TcTraceEnabled = traceEnabled; - if (TcTraceEnabled) - { - TrafConfigTrace.TraceInit( TcTraceEnabled, "0", traceFileName ); - } - - int rc = TrafConfigDb.Initialize(); - - return( rc ); -} - - -TC_Export int tc_delete_node( int nid - , const char *node_name ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - node_configuration_t nodeConfig; - - if (node_name) - { - rc = TrafConfigDb.GetNode( node_name, nodeConfig ); - if ( rc != TCSUCCESS) - { - return( rc ); - } - } - else - { - rc = TrafConfigDb.GetNode( nid, nodeConfig ); - if ( rc != TCSUCCESS) - { - return( rc ); - } - } - - if ( nodeConfig.nid != -1) - { - rc = TrafConfigDb.DeleteNodeData( nodeConfig.pnid ); - } - - return( rc ); -} - -TC_Export int tc_get_node( const char *node_name - , node_configuration_t *node_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetNode( node_name, *node_config ); - - return( rc ); -} - -TC_Export int tc_put_node( node_configuration_t *node_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.SavePNodeData( node_config->node_name - , node_config->pnid - , node_config->excluded_first_core - , node_config->excluded_last_core ); - if (rc == TCSUCCESS) - { - rc = TrafConfigDb.SaveLNodeData( node_config->nid - , node_config->pnid - , node_config->first_core - , node_config->last_core - , node_config->processors - , node_config->roles ); - } - - return( rc ); -} - -TC_Export int tc_get_pnode( const char *node_name - , physical_node_configuration_t *pnode_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetPNode( node_name, *pnode_config ); - - return( rc ); -} - -TC_Export int tc_put_pnode( physical_node_configuration_t *pnode_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.SavePNodeData( pnode_config->node_name - , pnode_config->pnid - , pnode_config->excluded_first_core - , pnode_config->excluded_last_core ); - - return( rc ); -} - -TC_Export int tc_get_nodes( int *count - , int max - , node_configuration_t *node_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - if ( node_config == NULL ) - { - max = 0; - } - - rc = TrafConfigDb.GetNodes( *count, max, node_config ); - - return( rc ); -} - -TC_Export int tc_get_snodes( int *scount - , int max - , physical_node_configuration_t *pnode_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - if ( pnode_config == NULL ) - { - max = 0; - } - - rc = TrafConfigDb.GetSNodes( *scount, max, pnode_config ); - - return( rc ); -} - -TC_Export int tc_delete_persist_keys( void ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - // - - return( rc ); -} - -TC_Export int tc_get_persist_keys( const char *persist_keys ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetPersistProcessKeys( persist_keys ); - - return( rc ); -} - -TC_Export int tc_put_persist_keys( const char *persist_keys ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - // - - return( rc ); -} - -TC_Export int tc_delete_persist_process( const char *persist_key_prefix ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - // - - return( rc ); -} - -TC_Export int tc_get_persist_process( const char *persist_key_prefix - , persist_configuration_t *persist_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetPersistProcess( persist_key_prefix, *persist_config ); - - return( rc ); -} - -TC_Export int tc_put_persist_process( const char *persist_key_prefix - , persist_configuration_t *persist_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - // - - return( rc ); -} - -TC_Export int tc_get_registry_cluster_set( int *count - , int max - , registry_configuration_t *registry_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetRegistryClusterSet( *count, max, registry_config ); - - return( rc ); -} - -TC_Export int tc_get_registry_process_set( int *count - , int max - , registry_configuration_t *registry_config ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetRegistryProcessSet( *count, max, registry_config ); - - return( rc ); -} - -TC_Export int tc_get_registry_key( const char *key ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - //rc = TrafConfigDb.GetRegistryKey( key ); - - return( rc ); -} - -TC_Export int tc_put_registry_key( const char *key ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.AddRegistryKey( key ); - - return( rc ); -} - -TC_Export int tc_get_registry_process( const char *process_name ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - //rc = TrafConfigDb.GetRegistryProcess( process_name ); - - return( rc ); -} - -TC_Export int tc_put_registry_process( const char *process_name ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.AddRegistryProcess( process_name ); - - return( rc ); -} - -TC_Export int tc_get_registry_cluster_data( const char *key - , const char *data ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - //rc = TrafConfigDb.GetRegistryClusterData( key, data ); - - return( rc ); -} - -TC_Export int tc_put_registry_cluster_data( const char *key - , const char *data ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.AddRegistryClusterData( key, data ); - - return( rc ); -} - -TC_Export int tc_get_registry_process_data( const char *process_name - , const char *key - , const char *data ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCNOTIMPLEMENTED; - - //rc = TrafConfigDb.GetRegistryProcessData( process_name, key, data ); - - return( rc ); -} - -TC_Export int tc_put_registry_process_data( const char *process_name - , const char *key - , const char *data ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.AddRegistryProcessData( process_name, key, data ); - - return( rc ); -} - -TC_Export TC_STORAGE_TYPE tc_get_storage_type( void ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCDBSTOREUNDEFINED ); - } - - return( TrafConfigDb.GetStorageType() ); -} - -TC_Export int tc_delete_unique_strings( int nid ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.DeleteUniqueString( nid ); - - return( rc ); -} - - -TC_Export int tc_get_unique_string( int nid, int id, const char *unique_string ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetUniqueString( nid, id, unique_string ); - - return( rc ); -} - -TC_Export int tc_put_unique_string( int nid, int id, const char *unique_string ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.AddUniqueString( nid, id, unique_string ); - - return( rc ); -} - -TC_Export int tc_get_unique_string_id( int nid, const char *unique_string, int *id ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetUniqueStringId( nid, unique_string, *id ); - - return( rc ); -} - -TC_Export int tc_get_unique_string_id_max( int nid, int *id ) -{ - if ( ! TrafConfigDb.IsInitialized() ) - { - return( TCNOTINIT ); - } - - int rc = TCDBOPERROR; - - rc = TrafConfigDb.GetUniqueStringIdMax( nid, *id ); - - return( rc ); -} - http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/monitor/linux/trafconfig.h ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/trafconfig.h b/core/sqf/monitor/linux/trafconfig.h deleted file mode 100644 index b1651a9..0000000 --- a/core/sqf/monitor/linux/trafconfig.h +++ /dev/null @@ -1,305 +0,0 @@ -/********************************************************************** -// @@@ START COPYRIGHT @@@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// @@@ END COPYRIGHT @@@ -********************************************************************/ -#ifndef TRAFCONFIG_H_ -#define TRAFCONFIG_H_ - -// -// On Windows, this would actually do something like: -// #define TRAF_Export __declspec(dllexport) -// -#define TC_Export - -#ifdef USE_TRAFCONF_DIAGS -#define TC_DIAG_UNUSED __attribute__((warn_unused_result)) -#else -#define TC_DIAG_UNUSED -#endif - -#ifdef USE_TRAFCONF_DEPRECATED -#define TC_DIAG_DEPRECATED __attribute__((deprecated)) -#else -#define TC_DIAG_DEPRECATED -#endif - -#define TC_REGISTRY_KEY_MAX 64 -#define TC_REGISTRY_VALUE_MAX 4096 -#define TC_PERSIST_PROCESSOR_NAME_MAX 128 -#define TC_PERSIST_ROLES_MAX 128 -#define TC_PERSIST_KEY_MAX 64 -#define TC_PERSIST_VALUE_MAX 4096 -#define TC_PERSIST_KEYS_VALUE_MAX 4096 -#define TC_NODES_MAX 256 -#define TC_SPARE_NODES_MAX 256 -#define TC_UNIQUE_STRING_VALUE_MAX 4096 - -#define TC_STORE_MYSQL "MYSQL" -#define TC_STORE_SQLITE "SQLITE" -#define TC_STORE_POSTGRESQL "POSTGRESQL" -#define TC_STORE_ZOOKEEPER "ZOOKEEPER" - -#define PERSIST_PROCESS_KEYS "PERSIST_PROCESS_KEYS" -#define PERSIST_PROCESS_NAME_KEY "PROCESS_NAME" -#define PERSIST_PROCESS_TYPE_KEY "PROCESS_TYPE" -#define PERSIST_PROGRAM_NAME_KEY "PROGRAM_NAME" -#define PERSIST_PROGRAM_ARGS_KEY "PROGRAM_ARGS" -#define PERSIST_REQUIRES_DTM "REQUIRES_DTM" -#define PERSIST_STDOUT_KEY "STDOUT" -#define PERSIST_RETRIES_KEY "PERSIST_RETRIES" -#define PERSIST_ZONES_KEY "PERSIST_ZONES" - -enum TC_STORAGE_TYPE { - TCDBSTOREUNDEFINED = 0 - , TCDBMYSQL = 1 // MySQL Database [TBD] - , TCDBPOSTGRESQL = 2 // PostgresQL Database [TBD] - , TCDBZOOKEEPER = 3 // Zookeeper - , TCDBSQLITE = 4 // Sqlite Database [deprecated] -}; - -enum TC_ERRORS { - TCSUCCESS = 0, // Successful operation - TCNOTIMPLEMENTED = -1,// Not implemented - TCNOTINIT = -2, // Database not open - TCALREADYINIT = -3, // Database already opened - TCDBOPERROR = -4, // Database operation failed - TCDBNOEXIST = -5, // Database operation yielded non-existent data - TCDBTRUNCATE = -6, // Database operation returned less data than available - TCDBCORRUPT = -7, // Internal processing error or database corruption -}; - -typedef struct node_configuration_s -{ - int nid; // Node Id (logical) - int pnid; // Physical Node ID - char node_name[TC_PERSIST_PROCESSOR_NAME_MAX]; // hostname - int excluded_first_core; // First or only core assigned - int excluded_last_core; // Last core assigned or -1 - int first_core; // First or only core assigned - int last_core; // Last core assigned or -1 - int processors; // Number logical processors - int roles; // Role assigment -} node_configuration_t; - -typedef struct physical_node_configuration_s -{ - int pnid; // Physical Node ID - char node_name[TC_PERSIST_PROCESSOR_NAME_MAX]; // hostname - int excluded_first_core; // First or only core assigned - int excluded_last_core; // Last core assigned or -1 - int spare_count; // Number of entries in spare_pnid[] - int spare_pnid[TC_SPARE_NODES_MAX]; // list of pnids for which this node can be a spare -} physical_node_configuration_t; - -typedef struct registry_configuration_s -{ - char scope[TC_REGISTRY_KEY_MAX]; - char key[TC_REGISTRY_KEY_MAX]; - char value[TC_REGISTRY_VALUE_MAX]; -} registry_configuration_t; - -typedef struct persist_configuration_s -{ - char persist_prefix[TC_PERSIST_KEY_MAX]; // DTM, TMID, or ... (PERSIST_PROCESS_KEYS) - char process_name[TC_PERSIST_VALUE_MAX]; // Process name {<prefix>[<format>]} - char process_type[TC_PERSIST_VALUE_MAX]; // DTM, TMID, PERSIST, ... - char program_name[TC_PERSIST_VALUE_MAX]; // Program executable name (no path in name) - char program_args[TC_PERSIST_VALUE_MAX]; // Program program arguments (runtime options) - char std_out[TC_PERSIST_VALUE_MAX]; // STDOUT {<prefix>[<format>]} - bool requires_DTM; // True when process requires transaction support - int persist_retries; // Process create retries - int persist_window; // Process create retries window (seconds) - char persist_zones[TC_PERSIST_VALUE_MAX]; // Process creation zones {<format>} -} persist_configuration_t; - - -TC_Export int tc_close( void ) -TC_DIAG_UNUSED; - -TC_Export const char *tc_errmsg( int err ) -TC_DIAG_UNUSED; - -TC_Export int tc_initialize( bool traceEnabled, const char *traceFileName = NULL ) -TC_DIAG_UNUSED; - - -TC_Export int tc_delete_node( int nid - , const char *node_name ) -TC_DIAG_UNUSED; - -TC_Export int tc_get_node( const char *node_name - , node_configuration_t *node_config ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_node( node_configuration_t *node_config ) -TC_DIAG_UNUSED; - - -TC_Export int tc_get_pnode( const char *node_name - , physical_node_configuration_t *pnode_config ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_pnode( physical_node_configuration_t *pnode_config ) -TC_DIAG_UNUSED; - -// -// Call this to get all configured logical nodes -// -// count: is number of node_config array entries returned -// max: is size of the node_config array -// node_config: is array of logical node configuration entries -// -// if count would be greater than max, an error is returned -// if node_config is null, max is ignored and -// number of node_config entries is returned in count -// -TC_Export int tc_get_nodes( int *count - , int max - , node_configuration_t *node_config ) -TC_DIAG_UNUSED; - -// -// Call this to get all configured spare nodes -// -// count: is number of pnode_config array entries returned -// max: is size of the pnode_config array -// pnode_config: is array of spare node configuration entries -// -// if count would be greater than max, an error is returned -// if pnode_config is null, max is ignored and -// number of pnode_config array entries is returned in count -// -TC_Export int tc_get_snodes( int *count - , int max - , physical_node_configuration_t *pnode_config ) -TC_DIAG_UNUSED; - - -TC_Export int tc_delete_persist_keys( void ) -TC_DIAG_UNUSED; - -TC_Export int tc_get_persist_keys( const char *persist_keys ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_persist_keys( const char *persist_keys ) -TC_DIAG_UNUSED; - - -TC_Export int tc_delete_persist_process( const char *persist_key_prefix ) -TC_DIAG_UNUSED; - -TC_Export int tc_get_persist_process( const char *persist_key_prefix - , persist_configuration_t *persist_config ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_persist_process( const char *persist_key_prefix - , persist_configuration_t *persist_config ) -TC_DIAG_UNUSED; - - -// -// Call this to get all cluster scope configuration registry entries -// -// count: is number of registry_config array entries returned -// max: is size of the registry_config array -// registry_configuration: is the array of cluster registry entries -// -// if count would be greater than max, an error is returned -// if registry_config is null, max is ignored and -// number of registry entries is returned in count -// -TC_Export int tc_get_registry_cluster_set( int *count - , int max - , registry_configuration_t *registry_config ) -TC_DIAG_UNUSED; - -// -// Call this to get all process scope configuration registry entries -// -// count: is number of registry_config array entries returned -// max: is size of the registry_config array -// registry_configuration: is the array of process registry entries -// -// if count would be greater than max, an error is returned -// if registry_config is null, max is ignored and -// number of registry entries entries is returned in count -// -TC_Export int tc_get_registry_process_set( int *count - , int max - , registry_configuration_t *registry_config ) -TC_DIAG_UNUSED; - - -TC_Export int tc_get_registry_key( const char *key ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_registry_key( const char *key ) -TC_DIAG_UNUSED; - - -TC_Export int tc_get_registry_process( const char *process_name ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_registry_process( const char *process_name ) -TC_DIAG_UNUSED; - - -TC_Export int tc_get_registry_cluster_data( const char *key - , const char *data ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_registry_cluster_data( const char *key - , const char *data ) -TC_DIAG_UNUSED; - - -TC_Export int tc_get_registry_process_data( const char *process_name - , const char *key - , const char *data ) -TC_DIAG_UNUSED; - -TC_Export int tc_put_registry_process_data( const char *process_name - , const char *key - , const char *data ) -TC_DIAG_UNUSED; - - -TC_Export TC_STORAGE_TYPE tc_get_storage_type( void ) -TC_DIAG_UNUSED; - - -TC_Export int tc_delete_unique_strings( int nid ) -TC_DIAG_UNUSED; - -TC_Export int tc_get_unique_string( int nid, int id, const char *unique_string ); -TC_DIAG_UNUSED; - -TC_Export int tc_put_unique_string( int nid, int id, const char *unique_string ) -TC_DIAG_UNUSED; - - -TC_Export int tc_get_unique_string_id( int nid, const char *unique_string, int *id ); -TC_DIAG_UNUSED; - -TC_Export int tc_get_unique_string_id_max( int nid, int *id ); -TC_DIAG_UNUSED; - -#endif // TRAFCONFIG_H_ http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/sqenvcom.sh ---------------------------------------------------------------------- diff --git a/core/sqf/sqenvcom.sh b/core/sqf/sqenvcom.sh index 8063225..eec2a3b 100644 --- a/core/sqf/sqenvcom.sh +++ b/core/sqf/sqenvcom.sh @@ -47,6 +47,15 @@ export PRODUCT_COPYRIGHT_HEADER="2015-2017 Apache Software Foundation" ############################################################## export TRAFODION_ENABLE_AUTHENTICATION=${TRAFODION_ENABLE_AUTHENTICATION:-NO} +# Set the Trafodion Configuration store type +if [[ -n "$CLUSTERNAME" ]]; then + # This is a cluster environment, not a workstation + #export TRAF_CONFIG_DBSTORE=MySQL + export TRAF_CONFIG_DBSTORE=Sqlite +else + export TRAF_CONFIG_DBSTORE=Sqlite +fi + # default SQ_IC to TCP if it is not set in sqenv.sh. Values are # IBV for infiniband, TCP for tcp export SQ_IC=${SQ_IC:-TCP} http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/sql/scripts/monitor.env ---------------------------------------------------------------------- diff --git a/core/sqf/sql/scripts/monitor.env b/core/sqf/sql/scripts/monitor.env new file mode 100644 index 0000000..bbf1ade --- /dev/null +++ b/core/sqf/sql/scripts/monitor.env @@ -0,0 +1,59 @@ +# @@@ START COPYRIGHT @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# @@@ END COPYRIGHT @@@ + +# Uncomment MON_TRACE_ENABLE and specific tracing level to enable +# Trafodion monitor process tracing +#MON_TRACE_ENABLE=1 +#MON_TRACE_EVLOG_MSG=1 +#MON_TRACE_INIT=1 +#MON_TRACE_RECOVERY=1 +#MON_TRACE_REQUEST=1 +#MON_TRACE_PROCESS=1 +#MON_TRACE_NOTICE=1 +#MON_TRACE_SYNC=1 +# Enable TC_TRACE_* along with MON_TRACE_TRAFCONFIG for more detail +#MON_TRACE_TRAFCONFIG=1 +#MON_TRACE_MLIO=1 + +#MON_TRACE_REQUEST_DETAIL=1 +#MON_TRACE_PROCESS_DETAIL=1 +#MON_TRACE_NOTICE_DETAIL=1 +#MON_TRACE_SYNC_DETAIL=1 +#MON_TRACE_MLIO_DETAIL=1 + +#MON_TRACE_TMSYNC=1 +#MON_TRACE_STATS=1 +#MON_TRACE_ENTRY_EXIT=1 +#MON_TRACE_REDIRECTION=1 +#MON_TRACE_HEALTH=1 +#MON_TRACE_SIG_HANDLER=1 + +# Uncomment TC_TRACE_ENABLE and specific tracing level to enable +# Trafodion Configuration library tracing +# TC_TRACE_ENABLE requires MON_TRACE_TRAFCONFIG above +#TC_TRACE_ENABLE=1 +#TC_TRACE_REQUEST=1 +#TC_TRACE_NODE=1 +#TC_TRACE_PERSIST=1 +#TC_TRACE_REGISTRY=1 +#TC_TRACE_INIT=1 +#TC_TRACE_LOG_MSG=1 +#TC_TRACE_ENTRY_EXIT=1 http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/sql/scripts/sqconfig.sample ---------------------------------------------------------------------- diff --git a/core/sqf/sql/scripts/sqconfig.sample b/core/sqf/sql/scripts/sqconfig.sample index 0b89554..f5964dd 100644 --- a/core/sqf/sql/scripts/sqconfig.sample +++ b/core/sqf/sql/scripts/sqconfig.sample @@ -55,6 +55,13 @@ end node ############################################################################### +# +# Section to configure persistent processes (see sqconfig.persist file) +# +############################################################################### + + +############################################################################### # # Note: You could use '%' as the first character on the line followed by # any SQ shell command. All the text would be passed verbatim. http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/sql/scripts/sqgen ---------------------------------------------------------------------- diff --git a/core/sqf/sql/scripts/sqgen b/core/sqf/sql/scripts/sqgen index aaf7157..a5d2d9d 100755 --- a/core/sqf/sql/scripts/sqgen +++ b/core/sqf/sql/scripts/sqgen @@ -28,9 +28,9 @@ function Usage { echo echo $script_name generates various Trafodion files in the $TRAF_HOME/sql/scripts directory. echo - echo "Usage: $script_name {-ft | -perf | [sqconfig_filename] | -h}" + echo "Usage: $script_name [ -? | -h ] [<sqconfig_filename>]" echo " -h Help" - echo " [sqconfig_filename] Name of the SQ config file (in $TRAF_HOME/sql/scripts directory)(defaults to 'sqconfig')" + echo " <sqconfig_filename> Name of the SQ config file (in $TRAF_HOME/sql/scripts directory)(defaults to 'sqconfig')" echo exit 1; } @@ -120,38 +120,38 @@ cd $TRAF_HOME/sql/scripts # Check to make sure this is a real cluster if [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then - # The configuration database can only be created the first time. - # Since nodes can be added and deleted through the 'shell node add/delete' - # commands, the 'sqconfig' node section may not reflect the current node - # configured. The 'sqregen' script can be used to update the SQCONFIG_FILE - # node section to reflect the current node configuration stored in - # the SQCONFIG_DB_FILE. - echo "Checking for the configuration file ($SQCONFIG_DB_FILE)." - if [ -f $SQCONFIG_DB_FILE ]; then - echo - echo "The configuration file ($SQCONFIG_DB_FILE) exists." - echo "Use the 'sqshell node add/delete' commands to change the node membership in the configuration database." - echo "Use the 'sqshell persist add/delete' commands to change the persist object configuration in the configuration database." - echo "Use the 'sqregen -node' script to update the $SQCONFIG_FILE 'node' section with the" - echo "current node membership in the configuration database." - echo "Use the 'sqregen -persist' script to update the $SQCONFIG_FILE 'persist' section with the" - echo "current persist configuration stored in the configuration database." - exit 1 + # The configuration database can only be created the first time. + # Since nodes can be added and deleted through the 'shell node add/delete' + # commands, the 'sqconfig' node section may not reflect the current node + # configured. The 'sqregen' script can be used to update the SQCONFIG_FILE + # node section to reflect the current node configuration stored in + # the SQCONFIG_DB_FILE. + echo "Checking for the configuration file ($SQCONFIG_DB_FILE)." + if [ -f $SQCONFIG_DB_FILE ]; then + echo + echo "The configuration file ($SQCONFIG_DB_FILE) exists." + echo "Use the 'sqshell node add/delete' commands to change the node membership in the configuration database." + echo "Use the 'sqshell persist add/delete' commands to change the persist object configuration in the configuration database." + echo "Use the 'sqregen -node' script to update the $SQCONFIG_FILE 'node' section with the" + echo "current node membership in the configuration database." + echo "Use the 'sqregen -persist' script to update the $SQCONFIG_FILE 'persist' section with the" + echo "current persist configuration stored in the configuration database." + exit 1 fi - GetSQcnfg + GetSQcnfg else echo echo "Workstation environment - Not a clustered environment" - if [ -f $SQCONFIG_DB_FILE ]; then - echo - echo "The configuration file ($SQCONFIG_DB_FILE) was previously created." - echo "Removing and re-creating $SQCONFIG_DB_FILE!" - rm -f $SQCONFIG_DB_FILE - fi + if [ -f $SQCONFIG_DB_FILE ]; then + echo + echo "The configuration file ($SQCONFIG_DB_FILE) was previously created." + echo "Removing and re-creating $SQCONFIG_DB_FILE!" + rm -f $SQCONFIG_DB_FILE + fi fi -# assume option is SQCONFIG_FILE +# Assume option is SQCONFIG_FILE while [ $# != 0 ] do flag="$1" @@ -210,8 +210,8 @@ else ./genms > $SQETC_DIR/ms.env lv_retcode=$? if [[ $lv_retcode != 0 ]]; then - echo "Error $lv_retcode while executing genms. Exiting..." - exit $lv_retcode + echo "Error $lv_retcode while executing genms. Exiting..." + exit $lv_retcode fi fi @@ -281,8 +281,8 @@ if [[ -n "$node_count" ]] && [[ "$node_count" -gt "1" ]]; then echo echo "Copying rest of the generated files to $PWD" - echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold gomon.warm rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD" - $PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold gomon.warm rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD + echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD" + $PDCP -w ${ExNodeList[@]} -x `uname -n` sqconfig sqshell gomon.cold rmsstart rmsstop rmscheck.sql ssmpstart ssmpstop sscpstart sscpstop $PWD echo "$PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD " $PDCP -w ${ExNodeList[@]} -x `uname -n` $SQCONFIG_FILE $SQCONFIG_DB_FILE $PWD http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/src/Makefile ---------------------------------------------------------------------- diff --git a/core/sqf/src/Makefile b/core/sqf/src/Makefile index 6b49f8e..62641a8 100644 --- a/core/sqf/src/Makefile +++ b/core/sqf/src/Makefile @@ -23,6 +23,7 @@ DP2=se all: cd seabed; $(MAKE) + cd trafconf; $(MAKE) cd fs; $(MAKE) cd security; $(MAKE) cd stub; $(MAKE) @@ -36,18 +37,21 @@ all: clean: cd seabed; $(MAKE) clean + cd trafconf; $(MAKE) clean cd win; $(MAKE) clean cd tm; $(MAKE) clean cd stfs; $(MAKE) -f Makefile.stub clean cd tools; $(MAKE) clean cleanall: cd seabed; $(MAKE) cleanall + cd trafconf; $(MAKE) cleanall cd win; $(MAKE) cleanall cd tm; $(MAKE) cleanall cd stfs; $(MAKE) -f Makefile.stub cleanall cd tools; $(MAKE) cleanall cleaner: cd seabed; $(MAKE) cleaner + cd trafconf; $(MAKE) cleaner cd win; $(MAKE) cleaner cd tm; $(MAKE) cleaner cd stfs; $(MAKE) -f Makefile.stub cleaner http://git-wip-us.apache.org/repos/asf/trafodion/blob/87849fcf/core/sqf/src/trafconf/Makefile ---------------------------------------------------------------------- diff --git a/core/sqf/src/trafconf/Makefile b/core/sqf/src/trafconf/Makefile new file mode 100644 index 0000000..f4704f7 --- /dev/null +++ b/core/sqf/src/trafconf/Makefile @@ -0,0 +1,119 @@ +# @@@ START COPYRIGHT @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# @@@ END COPYRIGHT @@@ + + +########################################################################### + +include ../../macros.gmk # top level +include ../macros.gmk +include ./macros.gmk + +# possible defines +# _MPICC_H - don't want C++ interface +# DEBUG +# USE_SEND_LAT +DEBUG = +DEFINES = -D_MPICC_H + +ifeq ($(USE_LOGGING),1) +DEFINES += -DUSE_LOGGING +endif +DEFINES += -DUSE_RH=$(RH_MAJ_VERS) + +LIBS = $(LIBTRAFCONFIG) + +# need -lrt for clock_gettime +LIBSX += -lrt + +# need -lsqlite3 for SQLite +LIBSX += -lsqlite3 + +PROGS = $(TRAFCONF) + +OBJTRAFCONFIG = $(OUTDIR)/trafconfig.o \ + $(OUTDIR)/tcdb.o \ + $(OUTDIR)/tcdbstore.o \ + $(OUTDIR)/tclog.o \ + $(OUTDIR)/tctrace.o \ + $(OUTDIR)/tcdbsqlite.o + +# $(OUTDIR)/tcdbmysql.o + +OBJTRAFCONF = $(OUTDIR)/trafconf.o \ + $(OUTDIR)/clusterconf.o \ + $(OUTDIR)/lnodeconfig.o \ + $(OUTDIR)/pnodeconfig.o \ + $(OUTDIR)/persistconfig.o \ + $(OUTDIR)/trace.o \ + $(OUTDIR)/otrace.o \ + $(OUTDIR)/threadtls.o + + +# Targets +# Uncomment the following target to disable parallel make +#.NOTPARALLEL: + +all: make_progs + +make_libs: $(LIBS) + +make_progs: make_libs + $(MAKE) $(PROGS) + +$(LIBEXPDIR)/libtrafconfig.so: $(OBJTRAFCONFIG) + @echo + @echo Building Trafodion Configuration Library + @echo + @echo $(CXX) $(LIBSX) $(LNK_FLGS) -shared -o $@ $(OBJTRAFCONFIG) + $(CXX) $(LIBSX) $(LNK_FLGS) -shared -o $@ $(OBJTRAFCONFIG) + +$(BINEXPDIR)/trafconf: $(OBJTRAFCONF) + @echo + @echo Building Trafodion Configuration Utility + @echo + @echo $(CXX) $(LIBSX) $(CDEPFLAGS) $(FLAGS) $(OPTIONS) $(INCLUDES) -o $@ $(OBJTRAFCONF) + @$(CXX) $(LIBSX) $(LIBTRAFCONFIGX) $(CDEPFLAGS) $(FLAGS) $(OPTIONS) $(INCLUDES) -o $@ $(OBJTRAFCONF) + +stop: + -killall shell monitor + +setup: + @# do nothing + +clean: + $(RM) $(OUTDIR)/*.o $(CDEPFILES) $(LIBS) dgt* $(OUTDIR)/*.gcda $(OUTDIR)/*.gcno $(OUTDIR)/*.gcov *.gcda *.gcno *.gcov + $(MAKE) cleantrafconfig cleantrafconf + +cleanall: clean + $(RM) -fr $(BUILD_PLAT) + +cleantrafconfig: + $(RM) $(LIBEXPDIR)/libtrafconfig.so $(OBJTRAFCONFIG) + +cleantrafconf: + $(RM) $(BINEXPDIR)/trafconf $(OBJTRAFCONF) + +cleaner: clean + $(RM) *~ + + +-include $(CDEP_DIR)/*.dep +_dummy := $(shell if [ ! -d $(CDEP_DIR) ]; then mkdir -p $(CDEP_DIR); fi)
