• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ process_options函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中process_options函数的典型用法代码示例。如果您正苦于以下问题:C++ process_options函数的具体用法?C++ process_options怎么用?C++ process_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了process_options函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv) {
  try {
    RMF_ADD_INPUT_FILE("rmf");
    process_options(argc, argv);
    if (boost::algorithm::ends_with(input, ".rmf2") &&
        boost::filesystem::exists(boost::filesystem::path(input) / "file")) {
      boost::filesystem::rename(
          boost::filesystem::path(input) / "file",
          boost::filesystem::path(input) / "file.rmf2info");
      std::cout << "Updated" << std::endl;
    } else {
      std::cout << "Nothing to do" << std::endl;
    }
  }
  catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
  return 0;
}
开发者ID:salilab,项目名称:imp,代码行数:19,代码来源:rmf_update.cpp


示例2: main

int main(int argc, char **argv) {
  try {
    RMF_ADD_INPUT_FILE("rmf");
    process_options(argc, argv);


    RMF::FileConstHandle rh = RMF::open_rmf_file_read_only(input);
    for (unsigned int i = 0; i < rh.get_number_of_frames(); ++i) {
      rh.set_current_frame(i);
      std::string cmt = rh.get_current_frame().get_name();
      if (!cmt.empty()) {
        std::cout << i << ": " << cmt << std::endl;
      }
    }
    return 0;
  } catch (const std::exception &e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
}
开发者ID:drussel,项目名称:imp,代码行数:19,代码来源:rmf_frames.cpp


示例3: main

/*********************************************************
 Start here.
**********************************************************/
int main(int argc, char **argv)
{	
	TALLOC_CTX *frame = talloc_stackframe();
	int local_flags = 0;
	int ret;

#if defined(HAVE_SET_AUTH_PARAMETERS)
	set_auth_parameters(argc, argv);
#endif /* HAVE_SET_AUTH_PARAMETERS */

	if (getuid() == 0) {
		local_flags = LOCAL_AM_ROOT;
	}

	load_case_tables();

	local_flags = process_options(argc, argv, local_flags);

	setup_logging("smbpasswd", DEBUG_STDERR);

	/*
	 * Set the machine NETBIOS name if not already
	 * set from the config file. 
	 */ 

	if (!init_names())
		return 1;

	/* Check the effective uid - make sure we are not setuid */
	if (is_setuid_root()) {
		fprintf(stderr, "smbpasswd must *NOT* be setuid root.\n");
		exit(1);
	}

	if (local_flags & LOCAL_AM_ROOT) {
		secrets_init();
		ret = process_root(local_flags);
	} else {
		ret = process_nonroot(local_flags);
	}
	TALLOC_FREE(frame);
	return ret;
}
开发者ID:ebrainte,项目名称:Samba,代码行数:46,代码来源:smbpasswd.c


示例4: ltrace_init

void
ltrace_init(int argc, char **argv)
{
	setlocale(LC_ALL, "");

	struct opt_p_t *opt_p_tmp;

	atexit(normal_exit);
	signal(SIGINT, signal_exit);	/* Detach processes when interrupted */
	signal(SIGTERM, signal_exit);	/*  ... or killed */

	argv = process_options(argc, argv);
	init_global_config();

	if (command) {
		/* Check that the binary ABI is supported before
		 * calling execute_program.  */
		{
			struct ltelf lte;
			if (ltelf_init(&lte, command) == 0)
				ltelf_destroy(&lte);
			else
				exit(EXIT_FAILURE);
		}

		pid_t pid = execute_program(command, argv);
		struct process *proc = open_program(command, pid);
		if (proc == NULL) {
			fprintf(stderr, "couldn't open program '%s': %s\n",
				command, strerror(errno));
			exit(EXIT_FAILURE);
		}

		trace_set_options(proc);
		continue_process(pid);
	}
	opt_p_tmp = opt_p;
	while (opt_p_tmp) {
		open_pid(opt_p_tmp->pid);
		opt_p_tmp = opt_p_tmp->next;
	}
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_ltrace,代码行数:42,代码来源:libltrace.c


示例5: parse_argv

/*-----------------------------------------------------------------------------
*   Parse command line, set options, including opts.files with list of
*	input files, including parsing of '@' lists
*----------------------------------------------------------------------------*/
void parse_argv( int argc, char *argv[] )
{
    int arg;

    init_module();

    if ( argc == 1 )
        exit_copyright();				/* exit if no arguments */

    process_options( &arg, argc, argv );	/* process all options, set arg to next */

    if ( arg >= argc )
        error_no_src_file();			/* no source file */

    if ( opts.verbose )
        display_options();				/* display status messages of select assembler options */

    if ( ! get_num_errors() )
        process_files( arg, argc, argv );	/* process each source file */
}
开发者ID:bitfixer,项目名称:bitfixer,代码行数:24,代码来源:options.c


示例6: main

/*
 * Main program
 */
int main(int argc, char **argv)
{
	int fd;

	process_options(argc, argv);

	/* Open the input file */
	if ((fd = open(img, O_RDONLY)) == -1) {
		perror("open input file");
		exit(1);
	}
	
	// get image length
   	imglen = lseek(fd, 0, SEEK_END);
	lseek (fd, 0, SEEK_SET);

	data = malloc (imglen);
	if (!data) {
		perror("out of memory");
		close (fd);
		exit(1);
	}
	
	// read image data
	read (fd, data, imglen);
		
	// Close the input file
	close(fd);

	if (dumpcontent)
		do_dumpcontent ();

	if (convertendian)
		do_endianconvert ();
	
	// free memory
	free (data);

	// Return happy 
	exit (0);
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:44,代码来源:jffs2dump.c


示例7: process_table

void process_table(table_input &in)
{
  options *opt = 0;
  format *form = 0;
  table *tbl = 0;
  if ((opt = process_options(in)) != 0 
      && (form = process_format(in, opt)) != 0
      && (tbl = process_data(in, form, opt)) != 0) {
    tbl->print();
    delete tbl;
  }
  else {
    error("giving up on this table");
    while (in.get() != EOF)
      ;
  }
  delete opt;
  delete form;
  if (!in.ended())
    error("premature end of file");
}
开发者ID:att,项目名称:uwin,代码行数:21,代码来源:main.cpp


示例8: main

int main(int argc, char * const argv[])
{
	int fd;
	struct blkpg_partition part;
	struct blkpg_ioctl_arg arg;

	process_options(argc, argv);

	fd = open(mtddev, O_RDWR | O_CLOEXEC);
	if (fd == -1)
		sys_errmsg_die("Cannot open %s", mtddev);

	memset(&part, 0, sizeof(part));

	memset(&arg, 0, sizeof(arg));
	arg.datalen = sizeof(part);
	arg.data = &part;

	switch (command) {
		case COMMAND_ADD:
			part.start = start_addr;
			part.length = length;
			strncpy(part.devname, part_name, sizeof(part.devname));
			arg.op = BLKPG_ADD_PARTITION;
			break;
		case COMMAND_DEL:
			part.pno = part_no;
			arg.op = BLKPG_DEL_PARTITION;
			break;
	}

	if (ioctl(fd, BLKPG, &arg))
		sys_errmsg_die("Failed to issue BLKPG ioctl");

	close(fd);

	/* Exit happy */
	return EXIT_SUCCESS;
}
开发者ID:sigma-star,项目名称:mtd-utils,代码行数:39,代码来源:mtdpart.c


示例9: main

int main(int argc, char** argv) {
  try {
    RMF_ADD_INPUT_FILE("rmf");
    RMF_ADD_OUTPUT_FILE("pdb");
    RMF_ADD_FRAMES;
    process_options(argc, argv);

    RMF::FileConstHandle rh = RMF::open_rmf_file_read_only(input);
    std::ostream* out;
    std::ofstream fout;
    if (!output.empty()) {
      fout.open(output.c_str());
      if (!fout) {
        std::cerr << "Error opening file " << output << std::endl;
        return 1;
      }
      out = &fout;
    } else {
      out = &std::cout;
    }
    RMF::decorator::IntermediateParticleFactory ipf(rh);
    RMF::decorator::AtomFactory af(rh);
    RMF::decorator::ChainFactory cf(rh);
    RMF::decorator::ResidueFactory rf(rh);
    RMF::NodeConstHandle rn = rh.get_root_node();
    for (unsigned int input_frame = start_frame, output_frame = 0;
         input_frame < rh.get_number_of_frames();
         input_frame += step_frame, ++output_frame) {
      rh.set_current_frame(RMF::FrameID(input_frame));
      *out << (boost::format("MODEL%1$9d") % (output_frame + 1)) << std::endl;
      write_atoms(*out, 0, rn, ipf, af, cf, rf);
      *out << "ENDMDL" << output_frame + 1 << std::endl;
    }
    return 0;
  }
  catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
}
开发者ID:j-ma-bu-l-l-ock,项目名称:imp,代码行数:39,代码来源:rmf_pdb.cpp


示例10: main

/**
 * \brief Entry point.
 * \param argc The number of input parameters.
 * \param argv The input parameters.
 */
int main(int argc, char *argv[]) {
	/* the resource manager must be initialized before any
	 * further actions are implemented */
	rm_init(&resource_mgr);

	if (process_options(argc, argv) == 1) {
		rm_cleanup_resources(&resource_mgr);
		exit(EXIT_FAILURE);
	}
	printf("Input: %s\n", cc_options.input_file);
	printf("Output: %s\n", cc_options.output_file);
	printf("IR: %s\n", cc_options.ir_file);

	yyin = fopen(cc_options.input_file, "r");

	if (!yyin) {
		printf("FAIL");
		exit(1);
	}

	//  yyparse();

	do {
		yyparse();
	} while (!feof(yyin));

	fclose(yyin);
	printallstart(cc_options.output_file);
	if (cc_options.print_ir == 1) {
		FILE * ir_file = fopen(cc_options.ir_file, "w");
		ir_set_file(ir_file);
		generate_ir_code();
		fclose(ir_file);
	}

	rm_cleanup_resources(&resource_mgr);
	return 0;
}
开发者ID:hagenduk,项目名称:Compilerbau,代码行数:43,代码来源:main.c


示例11: main

int main(int argc, char **argv){
	pthread_t *threads;
	int i=0;
	void *ret;
	
	process_options(argc, argv);
	
	ccsm_fd = ccsm_open();
	if (ccsm_fd < 0) {
		perror("ccsm_fd");
		return 1;
	}

	ccsm_create_set(ccsm_fd, "main", 0);
		
	threads = malloc(sizeof(pthread_t) * pipeline_len);
	if (!threads){
		fprintf(stderr, "can't initialise threads\n");
		exit(1);
	}

	printf("Creating the required set of threads.....\n");
	for(i=0;i<pipeline_len;i++){
		if (pthread_create(&threads[i],NULL,&thread_function_run, (void *)i)){
		       	fprintf(stderr, "failed creating thread");
        		exit(1);
        	}
	}
	
	for(i=0;i<pipeline_len;i++){
		pthread_join(threads[i], &ret);
	}

	ccsm_destroy_set(ccsm_fd, "main");
//	ccsm_close(ccsm_fd);
	
	return 0;
}
开发者ID:dillonhicks,项目名称:ipymake,代码行数:38,代码来源:multithreadsA.c


示例12: main

int main(int argc, char *argv[])
{
	int i;
	signal(SIGPIPE, SIG_IGN);

	openlog("flexd", LOG_ERR , LOG_INFO);
	syslog(LOG_WARNING, "Starting flexd");

	if (ax25_config_load_ports() == 0) {
		fprintf(stderr, "flexd error: No AX25 port data configured\n");
		return 1;
	}

	process_options(argc, argv);

	if ((i = read_conf()) == -1)
		return 1;

	if ((is_daemon) && (!daemon_start(TRUE)) ) {
		fprintf(stderr, "flexd: cannot become a daemon\n");
		return 1;
	}

	if ((i = update_flex()) == -1) {
		fprintf(stderr, "\nStopping application. Restart flexd after changing the configuration\n");
		signal(SIGKILL, hup_handler);
		return (i);
	}

	signal(SIGHUP, hup_handler);
	signal(SIGALRM, alarm_handler);
	alarm(poll_time);

	for (;;)
		pause();

	return 0;
}
开发者ID:ve7fet,项目名称:fpac,代码行数:38,代码来源:flexd.c


示例13: main

int main(int argc, char **argv)
{
	int ret;
	char ch;

	process_options(argc, argv);

	ret = mkfifo(STATUS_PIPE, 0666);

	if (ret == -1 && errno != EEXIST)
		errx(1, "Error creating named pipe");

	do {
		ch = action();

		if (ch == 'm')
			mem_map();
	} while (ch != 'x');

	remove(STATUS_PIPE);

	return 0;
}
开发者ID:AbhiramiP,项目名称:ltp,代码行数:23,代码来源:mem_process.c


示例14: main

/*! \addtogroup executables
 *  @{
 * \addtogroup client_FFTtoFile client_FFTtoFile
 * client_FFTtoBC_main
 * - @ref FFTProcessor with output to files
 * - configuration using command-line / XML
 * 
 * @{
 */
int main(int argc, char* argv[])
{
  boost::program_options::variables_map vm;
  try {
    vm = process_options("config/FFTProcessor.xml", argc, argv);
  } catch (const std::exception &e) {
    std::cerr << e.what() << std::endl;
    return 1;
  }

  boost::filesystem::path p(vm["config"].as<std::string>());
  LOGGER_INIT("./Log", p.stem().native());
  try {
    boost::property_tree::ptree config;
    read_xml(vm["config"].as<std::string>(), config, boost::property_tree::xml_parser::no_comments);

    const std::string stream_name("DataIQ");

    network::client::client<network::iq_adapter<repack_processor<FFTProcessorToFile<float> > > >
      c(config.get_child("FFTProcessor"));
    const std::set<std::string> streams(c.ls());
    if (streams.find(stream_name) != streams.end())
      ASSERT_THROW(c.connect_to(stream_name) == true);
    else
      throw std::runtime_error(str(boost::format("stream '%s' is not available")
                                   % stream_name));
    
    c.start();
    run_in_thread(network::get_io_service());
  } catch (const std::exception &e) {
    LOG_ERROR(e.what()); 
    std::cerr << e.what() << std::endl;
    return 1;
  }
  return 0;
}
开发者ID:hcab14,项目名称:HFMonitor,代码行数:45,代码来源:client_FFTtoFile_main.cpp


示例15: main

int main(int argc, const char* argv[])
{
  FILE *log = get_log(NULL);

  switch (process_options(argc, argv, log))
    {
      case 0:
        break;
      case -1:
        exit(EXIT_SUCCESS);
      default:
        exit(EXIT_FAILURE);
    }

  install_termination_signal_handlers (log);
  install_rotate_signal_handlers (log);
  install_log_rotate_signal_handlers (log, 0, SIGUSR1);

  int r = xport_to_queue (log);

  close_log (log);

  return r;
}
开发者ID:lwes,项目名称:lwes-journaller,代码行数:24,代码来源:xport_to_queue_main.c


示例16: main

int main( int   argc, char *argv[] )
{
	int used=0, NumRung;
	static int old_level ;
         bindtextdomain("linuxcnc", EMC2_PO_DIR);
         setlocale(LC_MESSAGES,"");
         setlocale(LC_CTYPE,"");
         textdomain("linuxcnc");
	old_level = rtapi_get_msg_level();
	compId=hal_init("classicladder"); //emc
	if (compId<0) return -1; //emc
	signal(SIGTERM,do_exit); //emc
	InitModbusMasterBeforeReadConf( );
	if (ClassicLadder_AllocAll())
	{
		char ProjectLoadedOk=TRUE;		
		process_options (argc, argv);
		if (nogui==TRUE)
		{
			rtapi_print(_("INFO CLASSICLADDER-   No ladder GUI requested-Realtime runs till HAL closes.\n"));
			ClassicLadder_InitAllDatas( );
			ProjectLoadedOk = LoadProjectFiles( InfosGene->CurrentProjectFileName  );
			if (pathswitch){   strcpy( InfosGene->CurrentProjectFileName, NewPath );   }
			InfosGene->LadderState = STATE_RUN;
			ClassicLadder_FreeAll(TRUE);
			hal_ready(compId);
			hal_exit(compId);	
			return 0; 
		} else {	
						
				for(NumRung=0;NumRung<NBR_RUNGS;NumRung++)   {   if ( RungArray[NumRung].Used ) used++;   }
				if((used==0) || ( (argc - optind) != 0) )
					    {	
						ClassicLadder_InitAllDatas( );
						ProjectLoadedOk = LoadProjectFiles( InfosGene->CurrentProjectFileName );
						InitGtkWindows( argc, argv );
						UpdateAllGtkWindows();
						if (pathswitch){   strcpy( InfosGene->CurrentProjectFileName, NewPath );   }
						UpdateWindowTitleWithProjectName( );
						MessageInStatusBar( ProjectLoadedOk?_("Project loaded and running"):_("Project failed to load..."));
						if (!ProjectLoadedOk) 
						{  
							   ClassicLadder_InitAllDatas( );   
							   if (modmaster) {    PrepareModbusMaster( );    }
						}
					    }else{
							   InitGtkWindows( argc, argv );
							   UpdateAllGtkWindows();
							   if (pathswitch){   strcpy( InfosGene->CurrentProjectFileName, NewPath );   }
							   UpdateWindowTitleWithProjectName( );
							   MessageInStatusBar(_("GUI reloaded with existing ladder program"));
							   if (modmaster) {    PrepareModbusMaster( );    }
							} 
							
				if (modslave)         {   InitSocketServer( 0/*UseUdpMode*/, ModbusServerPort/*PortNbr*/);  }
				InfosGene->LadderState = STATE_RUN;
				hal_ready(compId);
				gtk_main();
				rtapi_print(_("INFO CLASSICLADDER-   Ladder GUI closed. Realtime runs till HAL closes\n"));
				ClassicLadder_FreeAll(TRUE);
				hal_exit(compId);
				return 0;
			}		
	}
	 rtapi_print(_("ERROR CLASSICLADDER-   Ladder memory allocation error\n"));
	ClassicLadder_FreeAll(TRUE);
	rtapi_set_msg_level(old_level);
	hal_exit(compId);		
	return 0;
}
开发者ID:LinuxCNC,项目名称:linuxcnc,代码行数:70,代码来源:classicladder.c


示例17: mqtt_client_sub_task

/****************************************************************************
 * Public Functions
 ****************************************************************************/
int mqtt_client_sub_task(void *arg)
{
	int result = -1;
	int ret = 0;
	int argc;
	char **argv;

	argc = ((struct mqtt_sub_input *)arg)->argc;
	argv = ((struct mqtt_sub_input *)arg)->argv;
	if (argc == 1) {
		print_usage();
		return 0;
	}

	/* set  the seed of a new sequence of random values */
	mqtt_set_srand();

	/* check options and set variables */
	init_variables();
	ret = process_options(argc, argv);
	if (ret != 0) {
		if (ret == 2) {
			print_usage();
			result = 0;
		}
		goto done;
	}

	/* check and do options when a client is running */
	ret = check_option_on_client_running();
	if (ret == CHECK_OPTION_RESULT_CHECKED_OK) {
		result = 0;
		goto done;
	} else if (ret == CHECK_OPTION_RESULT_CHECKED_ERROR) {
		goto done;
	}

	/* make mqtt subscriber client config */
	if (make_client_config() != 0) {
		goto done;
	}

	/* create mqtt subscriber client */
	if (g_debug) {
		printf("initialize MQTT client context.\n");
	}
	g_mqtt_client_handle = mqtt_init_client(&g_mqtt_client_config);
	if (g_mqtt_client_handle == NULL) {
		fprintf(stderr, "Error: mqtt_init_client() failed.\n");
		clean_client_config();
		goto done;
	}

	/* connect to a mqtt broker */
	if (g_debug) {
		printf("connect to a MQTT broker (%s : %d).\n", g_host_addr, g_port);
	}
	if (mqtt_connect(g_mqtt_client_handle, g_host_addr, g_port, g_keepalive) != 0) {
		fprintf(stderr, "Error: mqtt_connect() failed.\n");

		if (mqtt_deinit_client(g_mqtt_client_handle) != 0) {
			fprintf(stderr, "Error: mqtt_deinit_client() failed.\n");
		} else {
			g_mqtt_client_handle = NULL;
		}
		clean_client_config();
		goto done;
	}

	if (g_debug) {
		printf("MQTT subscriber has started successfully.\n");
	}

	/* result is success */
	result = 0;

done:
	deinit_variables();

	return result;
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:84,代码来源:mqtt_client_sub.c


示例18: main

/*
 * Main program
 */
int main(int argc, char **argv)
{
    unsigned long ofs, end_addr = 0;
    unsigned long long blockstart = 1;
    int i, fd, ofd, bs, badblock = 0;
    //struct mtd_oob_buf oob = {0, 16, oobbuf};
    mtd_info_t meminfo;
    char pretty_buf[80];

    struct mtd_data_oob DataOobLocal;

    process_options(argc, argv);

    /* Open MTD device */
    if ((fd = open(mtddev, O_RDONLY)) == -1) {
        perror("open flash");
        exit (1);
    }

    /* Fill in MTD device capability structure */
    if (ioctl(fd, MEMGETINFO, &meminfo) != 0) {
        perror("MEMGETINFO");
        close(fd);
        exit (1);
    }

    /* Make sure device page sizes are valid */
    if (!(meminfo.oobsize == 64 && meminfo.oobblock == 2048) &&
            !(meminfo.oobsize == 16 && meminfo.oobblock == 512) &&
            !(meminfo.oobsize == 8 && meminfo.oobblock == 256)) {
        fprintf(stderr, "Unknown flash (not normal NAND)\n");
        close(fd);
        exit(1);
    }
    /* Read the real oob length */
    DataOobLocal.rtk_oob.length = meminfo.oobsize;

    /* Open output file for writing. If file name is "-", write to standard output. */
    if (!dumpfile) {
        ofd = STDOUT_FILENO;
    } else if ((ofd = open(dumpfile, O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) {
        perror ("open outfile");
        close(fd);
        exit(1);
    }

    /* Initialize start/end addresses and block size */
    if (length)
        end_addr = start_addr + length;
    if (!length || end_addr > meminfo.size)
        end_addr = meminfo.size;

    bs = meminfo.oobblock;

    /* Print informative message */
    fprintf(stderr, "Block size %u, page size %u, OOB size %u\n", meminfo.erasesize, meminfo.oobblock, meminfo.oobsize);
    fprintf(stderr, "Dumping data starting at 0x%08x and ending at 0x%08x...\n",
            (unsigned int) start_addr, (unsigned int) end_addr);

    /* Dump the flash contents */
    for (ofs = start_addr; ofs < end_addr ; ofs+=bs) {
        // new eraseblock , check for bad block
        if (blockstart != (ofs & (~meminfo.erasesize + 1))) {
            blockstart = ofs & (~meminfo.erasesize + 1);
            if ((badblock = ioctl(fd, MEMGETBADBLOCK, &blockstart)) < 0) {
                perror("ioctl(MEMGETBADBLOCK)");
                goto closeall;
            }
        }

        if (badblock) {
            if (omitbad)
                continue;
            memset (readbuf, 0xff, bs);
        } else {
            /* Read page data and exit on failure */
            /*
            if (pread(fd, readbuf, bs, ofs) != bs) {
            	perror("pread");
            	goto closeall;
            }
            */
        }

        //Ken, 20081005
        DataOobLocal.rtk_data.start = DataOobLocal.rtk_oob.start = ofs;
        DataOobLocal.rtk_data.length = meminfo.oobblock;
        DataOobLocal.rtk_data.ptr = readbuf;
        //DataOobLocal.rtk_oob.length = meminfo.oobsize;
        DataOobLocal.rtk_oob.ptr = oobbuf;

        if (ioctl(fd, MEMREADDATAOOB, &DataOobLocal) != 0) {
            perror("ioctl(MEMREADDATAOOB)");
            goto closeall;
        }

        /* Write out page data */
//.........这里部分代码省略.........
开发者ID:berte,项目名称:mediaplayer,代码行数:101,代码来源:nanddump.c


示例19: main

int main(int argc, char **argv) {
  int status;
  int idx;
  int active_last = 0;
  int active = 0;

  struct redir_t *redir;

  int keep_going = 1;
  int reload_config = 0;

  uint8_t hwaddr[6];
  struct ifreq ifr;

  int selfpipe;
  
  int fd = socket(AF_INET, SOCK_DGRAM, 0);

  options_init();

  chilli_signals(&keep_going, &reload_config);
  
  process_options(argc, argv, 1);
  
  safe_strncpy(ifr.ifr_name, _options.dhcpif, sizeof(ifr.ifr_name));

#ifdef SIOCGIFHWADDR  
  if (ioctl(fd, SIOCGIFHWADDR, (caddr_t)&ifr) == 0) {
    memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, PKT_ETH_ALEN);
  } else {
    log_err(errno, "could not get MAC address");
    return -1;
  }
#endif  

  close(fd);
  
  /* create an instance of redir */
  if (redir_new(&redir, &_options.uamlisten, _options.uamport, 
#ifdef ENABLE_UAMUIPORT
		_options.uamuiport
#else
		0
#endif
		)) {
    log_err(0, "Failed to create redir");
    return -1;
  }
  
  if (redir_listen(redir)) {
    log_err(0, "Failed to create redir listen");
    return -1;
  }

  redir_set(redir, hwaddr, (_options.debug));
  redir_set_cb_getstate(redir, sock_redir_getstate);
  
  redir->cb_handle_url = redir_handle_url;

  if (net_select_init(&sctx))
    log_err(errno, "select init");

  selfpipe = selfpipe_init();

  /* epoll */
  net_select_addfd(&sctx, selfpipe, SELECT_READ);
  net_select_addfd(&sctx, redir->fd[0], SELECT_READ);
  net_select_addfd(&sctx, redir->fd[1], SELECT_READ);

  if (_options.gid && setgid(_options.gid)) {
    log_err(errno, "setgid(%d) failed while running with gid = %d\n", 
	    _options.gid, getgid());
  }
  
  if (_options.uid && setuid(_options.uid)) {
    log_err(errno, "setuid(%d) failed while running with uid = %d\n", 
	    _options.uid, getuid());
  }

  while (keep_going) {

    /* select/poll */
    net_select_zero(&sctx);
    net_select_fd(&sctx, selfpipe, SELECT_READ);
    net_select_fd(&sctx, redir->fd[0], SELECT_READ);
    net_select_fd(&sctx, redir->fd[1], SELECT_READ);
  
    active = 0;

    if (reload_config) {
      reload_options(argc, argv);
      reload_config = 0;

      redir_set(redir, hwaddr, _options.debug);
    }

    for (idx=0; idx < max_requests; idx++) {

      conn_select_fd(&requests[idx].conn, &sctx);

//.........这里部分代码省略.........
开发者ID:DavidWeblib,项目名称:Coova-Chilli,代码行数:101,代码来源:main-redir.c


示例20: compile_and_link_program

cl_int
compile_and_link_program(int compile_program,
                         int link_program,
                         cl_program program,
                         cl_uint num_devices,
                         const cl_device_id *device_list,
                         const char *options,
                         cl_uint num_input_headers,
                         const cl_program *input_headers,
                         const char **header_include_names,
                         cl_uint num_input_programs,
                         const cl_program *input_programs,
                         void (CL_CALLBACK *pfn_notify) (cl_program program,
                                                         void *user_data),
                         void *user_data)
{
  char program_bc_path[POCL_FILENAME_LENGTH];
  char link_options[512];
  int errcode, error;
  int create_library = 0;
  int requires_cr_sqrt_div = 0;
  int spir_build = 0;
  unsigned flush_denorms = 0;
  uint64_t fsize;
  cl_device_id *unique_devlist = NULL;
  char *binary = NULL;
  unsigned device_i = 0, actually_built = 0;
  size_t i, j;
  char *temp_options = NULL;
  const char *extra_build_options =
    pocl_get_string_option ("POCL_EXTRA_BUILD_FLAGS", NULL);
  int build_error_code
      = (link_program ? CL_BUILD_PROGRAM_FAILURE : CL_COMPILE_PROGRAM_FAILURE);

  POCL_GOTO_LABEL_COND (PFN_NOTIFY, (program == NULL), CL_INVALID_PROGRAM);

  POCL_GOTO_LABEL_COND (PFN_NOTIFY, (num_devices > 0 && device_list == NULL),
                        CL_INVALID_VALUE);
  POCL_GOTO_LABEL_COND (PFN_NOTIFY, (num_devices == 0 && device_list != NULL),
                        CL_INVALID_VALUE);

  POCL_GOTO_LABEL_COND (PFN_NOTIFY, (pfn_notify == NULL && user_data != NULL),
                        CL_INVALID_VALUE);

  POCL_GOTO_LABEL_ON (PFN_NOTIFY, program->kernels, CL_INVALID_OPERATION,
                      "Program already has kernels\n");

  POCL_GOTO_LABEL_ON (PFN_NOTIFY,
                      (program->source == NULL && program->binaries == NULL),
                      CL_INVALID_PROGRAM,
                      "Program doesn't have sources or binaries! You need "
                      "to call clCreateProgramWith{Binary|Source} first\n");

  POCL_GOTO_LABEL_ON (PFN_NOTIFY,
                      ((program->source == NULL) && (link_program == 0)),
                      CL_INVALID_OPERATION,
                      "Cannot clCompileProgram when program has no source\n");

  POCL_LOCK_OBJ (program);

  program->main_build_log[0] = 0;

  /* TODO this should be somehow utilized at linking */
  POCL_MEM_FREE (program->compiler_options);

  if (extra_build_options)
    {
      size_t len = (options != NULL) ? strlen (options) : 0;
      len += strlen (extra_build_options) + 2;
      temp_options = (char *)malloc (len);

      temp_options[0] = 0;
      if (options != NULL)
        {
          strcpy (temp_options, options);
          strcat (temp_options, " ");
        }
      strcat (temp_options, extra_build_options);
    }
  else
    temp_options = (char*) options;

  if (temp_options)
    {
      i = strlen (temp_options);
      size_t size = i + 512; /* add some space for pocl-added options */
      program->compiler_options = (char *)malloc (size);
      errcode = process_options (temp_options, program->compiler_options,
                                 link_options, program, compile_program,
                                 link_program, &create_library, &flush_denorms,
                                 &requires_cr_sqrt_div, &spir_build, size);
      if (errcode != CL_SUCCESS)
        goto ERROR_CLEAN_OPTIONS;
    }

  POCL_MSG_PRINT_LLVM ("building program with options %s\n",
                       program->compiler_options);


  program->flush_denorms = flush_denorms;
//.........这里部分代码省略.........
开发者ID:pocl,项目名称:pocl,代码行数:101,代码来源:pocl_build.c



注:本文中的process_options函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ process_packet函数代码示例发布时间:2022-05-30
下一篇:
C++ process_message函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap