Пример #1
0
 void ObChunkServerMain::print_version()
 {
   fprintf(stderr, "chunkserver (%s %s)\n", PACKAGE_STRING, RELEASEID);
   fprintf(stderr, "SVN_VERSION: %s\n", svn_version());
   fprintf(stderr, "BUILD_TIME: %s %s\n\n", build_date(), build_time());
   fprintf(stderr, "Copyright (c) 2007-2011 Taobao Inc.\n");
 }
Пример #2
0
int so_main()
{
  printf(INTRODUCTION);
  printf("SVN Revision: %s\n", svn_version());
  printf("SO Build Time: %s %s\n", build_date(), build_time());
  printf("GCC Version: %s\n", __VERSION__);
  printf("\n");
  exit(0);
}
Пример #3
0
void LogBanner( void )
{
    LogPrintNoArg( LOG_CRIT, "havokmud  (c) 2010 Gavin Hurlbut" );
    LogPrint( LOG_CRIT, "%s", svn_version() );

#if 0
    cursesTextAdd( WINDOW_HEADER, ALIGN_LEFT, 1, 0, "havokmud" );
    cursesTextAdd( WINDOW_HEADER, ALIGN_LEFT, 10, 0, (char *)svn_version() );
    cursesTextAdd( WINDOW_HEADER, ALIGN_FROM_CENTER, 1, 0, 
                   "(c) 2009 Gavin Hurlbut" );
    cursesTextAdd( WINDOW_TAILER, ALIGN_RIGHT, 1, 0, "Ctrl-C to exit" );
    cursesTextAdd( WINDOW_TAILER, ALIGN_LEFT, 1, 0, 
                   "Use arrow keys for menus" );
    cursesTextAdd( WINDOW_TAILER, ALIGN_CENTER, 0, 0, 
                   "PgUp/PgDn to scroll logs" );
#endif

    versionAdd( "havokmud", (char *)svn_version() );
}
    void ObUpdateServerMain::print_version()
    {
      fprintf(stderr, "updateserver (%s %s)\n", PACKAGE_STRING, RELEASEID);
      fprintf(stderr, "SVN_VERSION: %s\n", svn_version());
      fprintf(stderr, "BUILD_TIME: %s %s\n", build_date(), build_time());
      fprintf(stderr, "BUILD_FLAGS: %s\n\n", build_flags());
#ifdef _BTREE_ENGINE_
      fprintf(stderr, "Using Btree Key-Value Engine.\n");
#else
      fprintf(stderr, "Using Hash Key-Value Engine.\n");
#endif
      fprintf(stderr, "Copyright (c) 2007-2011 Taobao Inc.\n");
    }
Пример #5
0
void run_test( const char *test_name, const char *test_parm )
{
    int all = 0 == strcmp(test_name, "all" );
    //int i;

#ifndef ARCH_ia32
    printf("sleeping 20 sec");
    hal_sleep_msec(200000);
#endif

    printf("Phantom ver %s svn %s test suite\n-----\n", PHANTOM_VERSION_STR, svn_version() );

    TEST(misc);

    TEST(crypt);

    // moved here to test first - rewritten
    TEST(ports);


    // TODO mem leak! out of mem for 200!
    //for( i = 200; i; i-- )
    {
        TEST(sem);
    }

    TEST(wtty);

    TEST(pool);

    // check if starting many threads eats memory
    //for( i = 200; i; i-- )
    {
        TEST(many_threads);
    }

#ifdef ARCH_mips
//    TEST(sem);
    TEST(01_threads);
#endif

    TEST(physmem);
    TEST(physalloc_gen);
    TEST(malloc);
    TEST(amap);

    TEST(cbuf);
    TEST(udp_send);
    TEST(udp_syslog);
    TEST(resolver);

    TEST(tftp);


    TEST(tcp_connect);


    // These are long
    TEST(dpc);
    TEST(timed_call);

    // must test after timed calls for it depends on them
    TEST(ports);


    // These are very long, do 'em last
    TEST(threads);

    TEST(absname);

#ifndef ARCH_ia32
//    TEST(sem);
    TEST(01_threads);
#endif

    TEST(rectangles);
    TEST(video);


    //TEST(video);

    //TEST(userland);

    printf("\n-----\n" );
    if(nFailed)
        printf("some tests FAILED\n" );
    else
        printf("all tests PASSED\n" );

    // CI: this message is being watched by CI scripts (ci-runtest.sh)
    printf( "-----\nPhantom test suite FINISHED\n-----\n" );

}
Пример #6
0
void get_package_and_svn(char* server_version, int64_t buf_len)
{
  const char* server_version_template = "%s_%s(%s %s)";
  snprintf(server_version, buf_len, server_version_template, PACKAGE_VERSION,
      svn_version(), build_date(), build_time());
}
Пример #7
0
int main(int argc, char *argv[]) 
{
	
		char *line;
		char *prompt = "myshell>";
		char *envPrompt = "DASH_PROMPT";
		char *args[2048];
		char *str;
		char *multiCmd[2048];
				
		int i=0;
		int flag;
	        int jobid;
		int code;
		int fd1,fd2;	
					
		tcpid = getpgrp();
		
		ObjectPtr myObj;
		NodePtr node;

		lst = createList(getKey,toString,freeObject);  // Creating a List
			
		prompt = getenv(envPrompt);

		if(prompt == NULL)
			prompt = "myshell>";
		
		using_history();

		if(signal(SIGINT,signalHandling) == SIG_ERR){}
		
		if(signal(SIGTSTP,signalHandling) == SIG_ERR){}

		if(signal(SIGTTOU,SIG_IGN)==SIG_ERR){}
		if(signal(SIGCHLD,SIG_DFL)==SIG_ERR){}

		if((argc == 2) && (strcmp(argv[1],"-v")==0))
		{
			printf("%s\n",svn_version());
			exit(0);
		}
			
		code = sigsetjmp(env,TRUE);
				
		while ((line=readline(prompt))) 		// Reading Input
		{
			if(line==NULL)
			{	
				printf("\n read line failed \n");
				continue;
			}
			
		      	add_history(line);
 
			str = (char *)mymalloc(sizeof(char)*(strlen(line)+1));
			strcpy(str,line);
											
			if(str[0] == '&' || str[0] == ';')
			{
				printf("dash: syntax error near unexpected token %c \n",str[0]);
				freeVar(line,str,args);
				continue;
			}
			
			while((pid = waitpid(-1,NULL,WNOHANG)) > 0)
			{
				node = search(lst,pid);
				((ObjectPtr)(node->obj))->jobStatus = 0;
				printf("%s\n",(*toString)(node->obj));
				removeNode(lst,node);
			}
			
						
			if(checkMultiCmd(str, multiCmd)== -1)
				continue;
			
			while(multiCmd[i])			
			{
				flag = searchAmp(multiCmd[i]);	// Function to check if there is an '&' in the Command
				struct IORedirect *ior = tokenize(multiCmd[i],args);
				if((int)ior == -1)
				break;		       // Parsing the Command that needs to be executed
				
				if(exitLogout(multiCmd[i]))	// Function to check Exit and Logout Commands
				{
					if(checkStoppedJobs())
					{
						//memset(multiCmd,0,sizeof(multiCmd));
						break;
					}
					else
					{
						freeVar(line,str,args);
						freeList(lst);
						memset(multiCmd,'\0',sizeof(multiCmd));
						myfree(ior);
						exit(0);
					}
				}
				if(checkEOF(multiCmd[i]))			// Function to check EOF
				{
					freeVar(line,str,args);
					memset(multiCmd,'\0',sizeof(multiCmd));	
					freeList(lst);
					myfree(ior);
					exit(0);
				}
				if(checkEmptyCmd(multiCmd[i]))		// Function to Check if Enter Key is pressed
				break;
			
			
				if((strcmp(args[0],"cd")==0) && (flag == FALSE))  // Function to check if 'cd' command is used
				{
					chgDir(args);
					break;
				}
			
				if((strcmp(args[0],"jobs")==0) && (flag == FALSE)) // Function to check if 'jobs' command is used
				{
					jobsCmd();
					break;
				}
			
				if(strcmp(args[0],"history")==0)
        		        {
                     	        	printHistory(args, str, flag);
	                                break;
       			        }
	
				if((strcmp(args[0],"bg") == 0) && (flag == FALSE))
				{
					bgCmd(args);
					break;
				}
					
				if((strcmp(args[0],"fg")==0) && (flag == FALSE))
				{
					fgCmd(args);
					break;
				}
			
				if(ampCount(multiCmd[i]))
				{
					printf(" dash: syntax error near unexpected token '&' \n");
					break;
				}
				if ( (pid = fork()) < 0)		// Forking a Process
				err_sys("fork error");
					
				else if (pid == 0) 
				{		
					struct stat buf;
					/* child */
    				     	if(flag == TRUE)
					{
						if(setpgid(0,0)!=0)
						perror("setpid() error");
					
						if(tcsetpgrp(0,tcpid)!=0)
						perror("tcsetpgrp() error");
					}
				
					if(ior->input != NULL)
					{
					
						if((fd1 = stat(ior->input,&buf))==-1){
                	                        printf("dash: %s file does not exist\n",ior->input);
                       			        break;
                                        	}

                                        	if((fd1= access(ior->input,R_OK))==-1){
                                   	        printf("dash: %s permission denied\n",ior->input);
                                        	break;
                                        	}
		                                if((fd1 = open(ior->input,O_RDONLY))==-1){
                		                printf("dash: %s inpRedirect opening failed\n",ior->input);
                                	        break;
                               		        }
                                      		else {
							close(0);
					 		dup(fd1);
						}
					}
	
					if(ior->output != NULL)				
					{
						/*if((fd1= access(ior->output,W_OK))==-1){
                        	                printf("dash: %s permission denied",ior->output);
                                	        break;}*/
                                        	if((fd2=open(ior->output,O_WRONLY|O_TRUNC|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH ))==-1){
                                        	printf("dash: %s outRedirect opening failed\n",ior->output);
                                       		break;}
                                       		else{
							close(1);
							dup(fd2);
						}
					}
					if (setpgid(0,0) != 0)
       		         		perror("setpgid() error");

			                if (tcsetpgrp(0, getpid()) != 0)
                			perror("tcsetpgrp() error");
					
					execvp(args[0],args);
					err_ret("couldn't execute: %s", line);
					exit(127);
				}
				if(flag == TRUE && (*args[0] !='\0'))
				{
					jobid = assignJobId();
					myObj = createObject(pid,multiCmd[i],jobid,1); 
					node = createNode(myObj);
					addAtRear(lst,node);
				
					printf("[%d] %d %s &\n",((ObjectPtr)(node->obj))->jobId, ((ObjectPtr)(node->obj))->key, ((ObjectPtr)(node->obj))->data);
					
					if ( (pid = waitpid(pid, &status, WNOHANG)) < 0)
					err_sys("waitpid error");
					if((tcsetpgrp(0,tcpid))!=0)
					perror("tcsetgroup error");
				
				}
				else
				{
				
					if ( (pid = waitpid(pid, &status, 0|WUNTRACED)) < 0)
					err_sys("waitpid error");
					if((tcsetpgrp(0,tcpid))!=0)
					perror("tcsetgroup error");
					if(WIFSTOPPED(status))
					{
						jobid = assignJobId();
                				myObj = createObject(pid,line,jobid,2);
                				node = createNode(myObj);
                				addAtRear(lst,node);
                				printf("%s\n",(*toString)(node->obj));
					}
			
				}
			i++;
			}
			freeVar(line,str,args);
			memset(multiCmd,'\0',sizeof(multiCmd));
			i=0;
		}
		freeList(lst);
		exit(0);
	}
Пример #8
0
void print_svn_revision() {
  printf(SVN_REVISION_FMT "%s\n", svn_version());
}
Пример #9
0
int main(int argc, char **argv)
{
  vector<string> cfg;
  size_t cfg_num = 0;
  if(argc==2) {
    cfg.push_back(argv[1]);
  } else if(argc==3) {
    cfg.push_back(argv[1]);
    cfg.push_back(argv[2]);
  } else {
    cfg.push_back(CONFIG_FILE);
  }
  time_t mtime;
  struct stat s;
  if (stat(cfg[cfg_num].c_str(), &s) == 0) {
    mtime = s.st_mtime;
  } else {
    mtime = 0;
  }
  cout << "BBC MDI Generator Rev " << svn_version()
       << ", using libsdixml Rev " << libsdixml::svn_version() << endl
       << "Implementing SDI Schema version " << libsdixml::SDI_Schema_version()
       << endl << "Reading config from " << cfg[cfg_num] << endl; cout.flush();
  Mdigen mdigen;
  /*
  DcpIn dcpin;
  dcpin.ReConfigure("dcp.udp://:9998");
  tagpacketlist t;
  dcpin.getFrame(t);
  for(tagpacketlist::iterator i=t.begin(); i!=t.end(); i++)
    cout << i->first << " " << i->second.size() << endl;
  */
#ifdef WIN32
 int iResult;
 WSADATA wsaData;
 // Initialize Winsock

 iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
 if (iResult != 0) {
    printf("WSAStartup failed: %d\n", iResult);
    exit(1);
 }
#else
  struct sigaction sa;
  sa.sa_flags = SA_SIGINFO;
  sigemptyset(&sa.sa_mask);
  sa.sa_sigaction = signal_handler;
  if (sigaction(SIGHUP, &sa, NULL) == -1)
  {
  	cerr << "error assigning signal handler" << endl;
	exit(1);
  }
  FAMConnection fc;
  if(FAMOpen(&fc)==0)
  {
    FAMRequest fr;
	if(cfg[0][0]!='/')
	{
			string path = getenv("PWD");
			cerr << path << endl;
			cfg[0] = path + "/" + cfg[0];
	}
    if(FAMMonitorFile(&fc, cfg[0].c_str(), &fr, NULL))
      cerr << "can't monitor " << cfg[0] << endl;
    else
      cout << "FAM Monitoring " << cfg[0] << endl;
  } else {
      cerr << "can't connect to file alteration monitor " << endl;
  }

#endif
  bool ok = true;
  int max_frames = -1;
  int reconf_interval = 32;
  int reconf = reconf_interval;
  ReConfigure(mdigen, cfg[cfg_num], ok, max_frames);
  while(ok) {
    try {
      mdigen.eachframe();
	  //cout << "Frame: " << mdigen.transmitted_frames << endl;
#ifndef WIN32
  while(FAMPending(&fc))
  {
    FAMEvent fe;
    FAMNextEvent(&fc, &fe);
	switch(fe.code)
	{
	case FAMDeleted:
	  break;
    case FAMChanged:
          cout << "file alteration monitor detected config change" << endl;
          reconfiguration_requested = true;
	  break;
    case FAMCreated:
    case FAMExists:
	  break;
    case FAMEndExist:
	  cout << "FAM initialised " << fe.filename << endl;
	  break;
    case FAMAcknowledge:
	  cout << "FAM cancel acknowledged " << fe.filename << endl;
	  break;
    case FAMStartExecuting:
    case FAMStopExecuting:
    case FAMMoved:
	  cout << "unexpected fam event " << fe.code << " '" << fe.filename << "'" << endl;
	  break;
    default:
	  cout << "unknown fam event " << fe.code << " '" << fe.filename << "'" << endl;
}
}
#endif
    }
    catch(char const* e) {
      cerr << e << endl; cerr.flush();
    }
    if(reconfiguration_requested) {
      ReConfigure(mdigen, cfg[cfg_num], ok, max_frames);
    }
	if(cfg.size()>1)
	{
	  reconf--;
	  if(reconf==0)
	  {
	    cfg_num = 1 - cfg_num;
        ReConfigure(mdigen, cfg[cfg_num], ok, max_frames);
		reconf = reconf_interval;
	  }
	}
    if(max_frames!=-1 && mdigen.transmitted_frames > max_frames)
      break;
  }
}
    int ObChunkServerMain::do_work()
    {
      int ret = OB_SUCCESS;
      char dump_config_path[OB_MAX_FILE_NAME_LENGTH];
      TBSYS_LOG(INFO, "oceanbase-chunk start svn_version=[%s] "
                "build_data=[%s] build_time=[%s]", svn_version(), build_date(),
                build_time());

      cs_reload_config_.set_chunk_server(server_);

      snprintf(dump_config_path,
               sizeof (dump_config_path), "etc/%s.config.bin", server_name_);
      config_mgr_.set_dump_path(dump_config_path);
      if (OB_SUCCESS != (ret = config_mgr_.base_init()))
      {
        TBSYS_LOG(ERROR, "init config manager error, ret: [%d]", ret);
      }
      else if (OB_SUCCESS != (ret = config_mgr_.load_config(config_)))
      {
        TBSYS_LOG(ERROR, "load config error, path: [%s], ret: [%d]",
                  config_, ret);
      }

      /* set rs address if command line has past in */
      if (strlen(cmd_rs_ip_) > 0 && cmd_rs_port_ != 0)
      {
        cs_config_.root_server_ip.set_value(cmd_rs_ip_);
        cs_config_.root_server_port = cmd_rs_port_;
      }
      if (cmd_port_ != 0)
      {
        cs_config_.port = cmd_port_;
      }
      if (strlen(cmd_data_dir_) > 0)
      {
        cs_config_.datadir.set_value(cmd_data_dir_);
      }
      if (strlen(cmd_appname_) > 0)
      {
        cs_config_.appname.set_value(cmd_appname_);
      }
      if (strlen(cmd_devname_) > 0)
      {
        cs_config_.devname.set_value(cmd_devname_);
      }
      if (strlen(config_))
      {
        TBSYS_LOG(INFO, "using config file path: [%s]", config_);
      }
      if (strlen(cmd_extra_config_) > 0
          && OB_SUCCESS != (ret = cs_config_.add_extra_config(cmd_extra_config_)))
      {
        TBSYS_LOG(ERROR, "Parse extra config error! string: [%s], ret: [%d]",
                  cmd_extra_config_, ret);
      }
      cs_config_.print();

      if (OB_SUCCESS == ret && OB_SUCCESS != (ret = cs_config_.check_all()))
      {
        TBSYS_LOG(ERROR, "check config failed, ret: [%d]", ret);
      }

      if (OB_SUCCESS != ret)
      {
        TBSYS_LOG(ERROR, "Start chunk server failed, ret: [%d]", ret);
      }
      else
      {
        server_.set_io_thread_count((int)cs_config_.io_thread_count);
        server_.start();
      }

      return ret;
    }