您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ start_logging函数代码示例

51自学网 2021-06-03 08:22:01
  C++
这篇教程C++ start_logging函数代码示例写得很实用,希望能帮到您。

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

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

示例1: main

int main(int argc, char **argv){	printf("Hello world/n");	start_logging();		return fuse_main(argc, argv, &ndfs_oper, NULL);}
开发者ID:nodarius,项目名称:NDFS,代码行数:7,


示例2: adb_main

int adb_main(int is_daemon, int server_port){	atexit(adb_cleanup);#if defined(HAVE_FORKEXEC)	// No SIGCHLD. Let the service subproc handle its children.	signal(SIGPIPE, SIG_IGN);#endif	init_transport_registration();	if (access(USB_FFS_ADB_EP0, F_OK) == 0) {		// listen on USB		usb_init();	}	if (is_daemon) {		// inform our parent that we are up and running.		fprintf(stderr, "OK/n");		start_logging();	}	D("Event loop starting/n");	fdevent_loop();	usb_cleanup();	return 0;}
开发者ID:feedcafe,项目名称:adbd,代码行数:28,


示例3: start_logging

//Lei Deng---------------------------------------------------void Copter::my_mission_resume_setup(void){    start_logging();    if(g.wp_resume_mode == 0)//NO resume action is needed. Do Nothing.        return;    //Last mission has been accomplished, NO resume action is needed. Do Nothing.    if(g.wp_rsm_pre_wp < 0)        return;    switch(g.wp_resume_mode)    {    case 1://resume from certain point stored in parameters: wp_rsm_x, wp_rsm_y and wp_rsm_z        resume_mission_POS(g.wp_rsm_pre_wp, g.wp_rsm_x, g.wp_rsm_y, g.wp_rsm_z);        break;    case 2://resume from the previous waypoint        resume_mission_previous_WP(g.wp_rsm_pre_wp);        break;    case 3://resume from the first RTL command was triggered        resume_mission_from_first_RTL(g.wp_rsm_x, g.wp_rsm_y, g.wp_rsm_z);        break;    default:        break;    }    gcs_send_text(MAV_SEVERITY_WARNING,"Mission Re-Scheduled");#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUXDataFlash.flush();#endif}
开发者ID:webclock,项目名称:ardupilot,代码行数:36,


示例4: start_logging

/*  should we log a message type now? */bool Rover::should_log(uint32_t mask){    if (!(mask & g.log_bitmask) || in_mavlink_delay) {        return false;    }    bool ret = hal.util->get_soft_armed() || DataFlash.log_while_disarmed();    if (ret && !DataFlash.logging_started() && !in_log_download) {        start_logging();    }    return ret;}
开发者ID:Metello,项目名称:ardupilot,代码行数:14,


示例5: start_logging

/*  should we log a message type now? */bool Rover::should_log(uint32_t mask){    if (!(mask & g.log_bitmask) || in_mavlink_delay) {        return false;    }    bool ret = hal.util->get_soft_armed() || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0;    if (ret && !DataFlash.logging_started() && !in_log_download) {        start_logging();    }    return ret;}
开发者ID:MarkHarbison,项目名称:ardupilot,代码行数:14,


示例6: main

int main(int argc, char **argv){	signal(SIGINT, sigint_handler);	if (argc == 1 || argc == 2 && strcmp(argv[1], "-h") == 0) {		print_help();		return 0;	}	if (argc == 3) {		int file_format;		if (strcmp(argv[1], "-b") == 0) {			fp = fopen(argv[2], "wb");			file_format = BINARY;		} else if (strcmp(argv[1], "-t") == 0) {			fp = fopen(argv[2], "w");			file_format = TEXT;		} else {			printf("Incorrect option./n");			print_help();			return -1; 		}				if (!fp) {			printf("Error opening file./n");			return -2;		}				start_logging(fp, file_format);		close(fp);		return 0;	} 	if (argc == 4 && strcmp(argv[1], "-c") == 0) {		f_in = fopen(argv[2], "rb");		f_out = fopen(argv[3], "w");				if (!(f_in && f_out)) {			printf("Error opening file/n");			return -3;		}		convert_file(f_in, f_out);				fclose(f_in);		fclose(f_out);		return 0;	} 		printf("Incorrect option./n");	print_help();	return -1;}
开发者ID:ujohnny,项目名称:infocoll,代码行数:52,


示例7: direct_log

result direct_log(logging_mode mMode, const char *sString){	if (!log_file && !start_logging()) return false;	if (current_log_mode & mMode)	{	result outcome = fprintf(log_file, "%s/n", sString) >= 0;	fflush(log_file);	return outcome;	}	return true;}
开发者ID:BackupTheBerlios,项目名称:rservr-svn,代码行数:13,


示例8: argc_

  Environment::Environment(int argc, char** argv)    : argc_(argc)    , argv_(0)    , fork_exec_lock_()    , halt_lock_()    , finalizer_thread_(NULL)    , loader_(NULL)  {    String::init_hash();    copy_argv(argc, argv);    ruby_init_setproctitle(argc, argv);    shared = new SharedState(this, config, config_parser);    load_vm_options(argc_, argv_);    check_io_descriptors();    root_vm = shared->thread_nexus()->new_vm(shared, "ruby.main");    root_vm->set_main_thread();    shared->set_root_vm(root_vm);    size_t stack_size = 0;    struct rlimit rlim;    if(getrlimit(RLIMIT_STACK, &rlim) == 0) {      stack_size = rlim.rlim_cur;    }    root_vm->set_stack_bounds(stack_size);    root_vm->set_current_thread();    state = new State(root_vm);    loader_ = new memory::TypedRoot<Object*>(state);    NativeMethod::init_thread(state);    start_logging(state);    log_argv();    if(config.log_config.value) {      std::string options;      config_parser.parsed_options(options);      if(options.size()) {        logger::write("config: %s", options.c_str());      }    }  }
开发者ID:sodabrew,项目名称:rubinius,代码行数:51,


示例9: start_logging

/*  should we log a message type now? */bool Copter::should_log(uint32_t mask){#if LOGGING_ENABLED == ENABLED    if (!(mask & g.log_bitmask) || in_mavlink_delay) {        return false;    }    bool ret = motors.armed() || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0;    if (ret && !DataFlash.logging_started() && !in_log_download) {        start_logging();    }    return ret;#else    return false;#endif}
开发者ID:AquilaUAS,项目名称:ardupilot,代码行数:18,


示例10: start_logging

/*  should we log a message type now? */bool Rover::should_log(uint32_t mask){    if (!(mask & g.log_bitmask) || in_mavlink_delay) {        return false;    }    bool ret = hal.util->get_soft_armed() || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0;    if (ret && !DataFlash.logging_started() && !in_log_download) {        // we have to set in_mavlink_delay to prevent logging while        // writing headers        in_mavlink_delay = true;        start_logging();        in_mavlink_delay = false;    }    return ret;}
开发者ID:Abdullah1990,项目名称:ardupilot,代码行数:18,


示例11: start_logging

/*  should we log a message type now? */bool Sub::should_log(uint32_t mask){#if LOGGING_ENABLED == ENABLED    if (!(mask & g.log_bitmask) || in_mavlink_delay) {        return false;    }    bool ret = motors.armed() || DataFlash.log_while_disarmed();    if (ret && !DataFlash.logging_started() && !in_log_download) {        start_logging();    }    return ret;#else    return false;#endif}
开发者ID:ProfFan,项目名称:ardupilot,代码行数:18,


示例12: set_log_file

result set_log_file(text_info fFile){	start_logging();	if (geteuid() == 0 || getegid() == 0)	{    log_log_file_change_error(fFile, error_su_violation);	return false;	}    log_log_file_change_old(fFile);	int new_file = open(fFile, log_open_append);	if (new_file < 0) new_file = open(fFile, log_open_append_create, create_mode);	if (new_file < 0) new_file = open(fFile, log_open_truncate, create_mode);	if (new_file < 0) new_file = open(fFile, log_open_truncate_create, create_mode);	if (new_file < 0)	{    log_log_file_change_error(fFile, error_file_open);	return false;	}	if (dup2(new_file, log_output) < 0)	{	close(new_file);    log_log_file_change_error(fFile, error_internal);	return false;	}	close(new_file);	if (!(log_file = fdopen(log_output, "w")))	{	close(log_output);    log_log_file_change_error(fFile, error_internal);	return false;	}	setlinebuf(log_file);	clearerr(log_file);    log_log_file_change_new();	return true;}
开发者ID:BackupTheBerlios,项目名称:rservr-svn,代码行数:46,


示例13: start_logging

/*  should we log a message type now? */bool Plane::should_log(uint32_t mask){#if LOGGING_ENABLED == ENABLED    if (!(mask & g.log_bitmask) || in_mavlink_delay) {        return false;    }    bool ret = hal.util->get_soft_armed() || (g.log_bitmask & MASK_LOG_WHEN_DISARMED) != 0;    if (ret && !DataFlash.logging_started() && !in_log_download) {        // we have to set in_mavlink_delay to prevent logging while        // writing headers        start_logging();    }    return ret;#else    return false;#endif}
开发者ID:PepMartiSaumell,项目名称:ardupilot,代码行数:20,


示例14: device_event_cb

static void device_event_cb(const idevice_event_t* event, void* userdata){	if (event->event == IDEVICE_DEVICE_ADD) {		if (!syslog) {			if (!udid) {				udid = _strdup(event->udid);			}			if (strcmp(udid, event->udid) == 0) {				if (start_logging() != 0) {					fprintf(stderr, "Could not start logger for udid %s/n", udid);				}			}		}	} else if (event->event == IDEVICE_DEVICE_REMOVE) {		if (syslog && (strcmp(udid, event->udid) == 0)) {			stop_logging();			fprintf(stdout, "[disconnected]/n");		}	}}
开发者ID:skposs,项目名称:WinLibmobiledevice,代码行数:20,


示例15: local_log

result local_log(logging_mode mMode, const char *sString){	//TODO: protect this with a mutex?	if (!log_file && !start_logging()) return false;	static char time_string[PARAM_DEFAULT_FORMAT_BUFFER];	if (current_log_mode & mMode)	{	time_t current_time = time(NULL);	strftime(time_string, PARAM_DEFAULT_FORMAT_BUFFER, PARAM_LOG_TIME_FORMAT, localtime(&current_time));	result outcome = fprintf(log_file, CLIENT_LOGGING_TAG, time_string,	                   client_name.size()? client_name.c_str() : alternate_name.c_str(),	                   program_name.c_str(), internal_pgid, sString) >= 0;	fflush(log_file);	return outcome;	}	return true;}
开发者ID:BackupTheBerlios,项目名称:rservr-svn,代码行数:21,


示例16: main

int main(int argc, char **argv){	(void)argc;	(void)argv;	if (init_events_init())		return 1;	start_logging();	if (init_rand_seed())		return 1;	if (ensure_single_instance())		return 1;	if (conf_load())		return 1;	if (cl_init())		return 1;	if (start_task_queue())		return 1;	if (start_state_manager())		return 1;	if (start_debug_console())		return 1;	if (enqueue_task(main2, NULL))		return 1;	if (start_rpc_svc())		return 1;	return 0;}
开发者ID:pdziepak,项目名称:rcl,代码行数:39,


示例17: set_log_fd

result set_log_fd(int fFile){	start_logging();    log_log_fd_change_old(fFile);	if (fFile < 0)	//NOTE: a negative number for a file descriptor effectively disables logging	{	close(log_output); //NOTE: redundant most of the time	FILE *old_file = log_file;	log_file = NULL;	if (old_file) fclose(old_file);	return true;	}	if (dup2(fFile, log_output) < 0)	{    log_log_fd_change_error(fFile, error_internal);	return false;	}	if (!(log_file = fdopen(log_output, "w")))	{	close(log_output);    log_log_fd_change_error(fFile, error_internal);	return false;	}	setlinebuf(log_file);	clearerr(log_file);    log_log_file_change_new();	return true;}
开发者ID:BackupTheBerlios,项目名称:rservr-svn,代码行数:36,


示例18: error

/**    This function exec byte code of instructions    @param      code  array of byte code    @return number of error(0 if no error)*/int cpu_run(char* addr_code){    assert(addr_code);    cpu_t* cpu = NULL;    cpu_ctor(&cpu, CPU_STACK_MAX, addr_code);    char* current_byte = addr_code;    start_logging("logs.txt");    while(FOREVER)    {        int cmd = *current_byte;        current_byte++;        //printf("%d /n",cmd);        switch(cmd)        {        case PUSH:            if(cpu_push(cpu, &current_byte)) printf("CPU CRASHED! PUSH HAVEN'T FULFILLED");            break;        case POP:            if(cpu_pop(cpu, &current_byte)) printf("CPU CRASHED! POP HAVEN'T FULFILLED");            break;        case OK:            if(cpu_ok(cpu)) printf("CPU CRASHED! CPU ISN'T OK");            break;        case DUMP:            if(cpu_dump(cpu)) printf("CPU CRASHED! DUMP HAVEN'T FULFILLED");            break;        case ADD:            if(cpu_add(cpu)) printf("CPU CRASHED! ADD HAVEN'T FULFILLED");            break;        case SUB:            if(cpu_sub(cpu)) printf("CPU CRASHED! SUB HAVEN'T FULFILLED");            break;        case MUL:            if(cpu_mul(cpu)) printf("CPU CRASHED! MUL HAVEN'T FULFILLED");            break;        case DIR:            if(cpu_dir(cpu)) printf("CPU CRASHED! DIR HAVEN'T FULFILLED");            break;        case SIN:            if(cpu_sin(cpu)) printf("CPU CRASHED! SIN HAVEN'T FULFILLED");            break;        case COS:            if(cpu_cos(cpu)) printf("CPU CRASHED! COS HAVEN'T FULFILLED");            break;        case SQRT:            if(cpu_sqrt(cpu)) printf("CPU CRASHED! SQRT HAVEN'T FULFILLED");            break;        case JA:            if(cpu_ja(cpu, &current_byte)) printf("CPU CRASHED! JA HAVEN'T FULFILLED");            break;        case JAE:            if(cpu_jae(cpu, &current_byte)) printf("CPU CRASHED! JAE HAVEN'T FULFILLED");            break;        case JB:            if(cpu_jb(cpu, &current_byte)) printf("CPU CRASHED! JB HAVEN'T FULFILLED");            break;        case JBE:            if(cpu_jbe(cpu, &current_byte)) printf("CPU CRASHED! JBE HAVEN'T FULFILLED");            break;        case JE:            if(cpu_je(cpu, &current_byte)) printf("CPU CRASHED! JE HAVEN'T FULFILLED");            break;        case JNE:            if(cpu_jne(cpu, &current_byte)) printf("CPU CRASHED! JNE HAVEN'T FULFILLED");            break;        case JMP:            if(cpu_jmp(cpu, &current_byte)) printf("CPU CRASHED! JMP HAVEN'T FULFILLED");            break;//.........这里部分代码省略.........
开发者ID:ivanychev,项目名称:iLab_firstcourse,代码行数:101,


示例19: server_thread

int server_thread(void * args) {  adb_sysdeps_init();  struct adb_main_input* input = (struct adb_main_input*)args;  int is_daemon = input->is_daemon;  int server_port = input->server_port;  int is_lib_call = input->is_lib_call;  int exit_fd = input->exit_fd;  void (*on_track_ready)() = input->on_track_ready;  char * log_path = input->log_path;#ifdef WIN32  LOG_FILE = fopen(log_path, "w");#endif  if (is_lib_call) {      transport_type ttype = kTransportAny;      char* serial = NULL;      serial = getenv("ANDROID_SERIAL");      adb_set_transport(ttype, serial);      adb_set_tcp_specifics(server_port);    }    D("!! C code has started/n");    // atexit(adb_cleanup);#ifdef HAVE_WIN32_PROC    SetConsoleCtrlHandler( ctrlc_handler, TRUE );#elif defined(HAVE_FORKEXEC)    // No SIGCHLD. Let the service subproc handle its children.    signal(SIGPIPE, SIG_IGN);#endif    init_transport_registration();    HOST = 1;    usb_vendors_init();    D("Before USB init/n");    usb_init();    D("After USB init/n");	#ifndef NO_AUTH    adb_auth_init();	#endif	  D("After auth_init/n");    char local_name[30];    build_local_name(local_name, sizeof(local_name), server_port);    if(install_listener(local_name, "*smartsocket*", NULL, 0)) {        D("Error installing listener/n");        return -1;    }    if (is_daemon)    {        // inform our parent that we are up and running.#ifdef HAVE_WIN32_PROC        DWORD  count;        WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK/n", 3, &count, NULL );#elif defined(HAVE_FORKEXEC)        fprintf(stderr, "OK/n");#endif        start_logging();    }    on_track_ready();    D("Starting event loop.../n");    fdevent_loop(exit_fd);    D("Done with loop/n");    for (int i = 0; i < _fds->length; i++) {      D("Closing fd: %d at index: %d/n", _fds->base[i], i);      adb_close(_fds->base[i]);    }    free_int_array_list(_fds);    // usb_cleanup();    return 0;}
开发者ID:FublyaGoth,项目名称:r2d2b2g,代码行数:83,


示例20: adb_main

//.........这里部分代码省略.........        setenv("EXTERNAL_STORAGE", adb_external_storage, 1);    } else {        D("Warning: ADB_EXTERNAL_STORAGE is not set.  Leaving EXTERNAL_STORAGE"          " unchanged./n");    }    /* don't listen on a port (default 5037) if running in secure mode */    /* don't run as root if we are running in secure mode */    if (should_drop_privileges()) {        drop_capabilities_bounding_set_if_needed();        /* add extra groups:        ** AID_ADB to access the USB driver        ** AID_LOG to read system logs (adb logcat)        ** AID_INPUT to diagnose input issues (getevent)        ** AID_INET to diagnose network issues (netcfg, ping)        ** AID_GRAPHICS to access the frame buffer        ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)        ** AID_SDCARD_R to allow reading from the SD card        ** AID_SDCARD_RW to allow writing to the SD card        ** AID_MOUNT to allow unmounting the SD card before rebooting        ** AID_NET_BW_STATS to read out qtaguid statistics        */        gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS,                           AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_R, AID_SDCARD_RW,                           AID_MOUNT, AID_NET_BW_STATS };        if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {            exit(1);        }        /* then switch user and group to "shell" */        if (setgid(AID_SHELL) != 0) {            exit(1);        }        if (setuid(AID_SHELL) != 0) {            exit(1);        }        D("Local port disabled/n");    } else {        char local_name[30];        if ((root_seclabel != NULL) && (is_selinux_enabled() > 0)) {            // b/12587913: fix setcon to allow const pointers            if (setcon((char *)root_seclabel) < 0) {                exit(1);            }        }        build_local_name(local_name, sizeof(local_name), server_port);        if(install_listener(local_name, "*smartsocket*", NULL, 0)) {            exit(1);        }    }    int usb = 0;    if (access(USB_ADB_PATH, F_OK) == 0 || access(USB_FFS_ADB_EP0, F_OK) == 0) {        // listen on USB        usb_init();        usb = 1;    }    // If one of these properties is set, also listen on that port    // If one of the properties isn't set and we couldn't listen on usb,    // listen on the default port.    property_get("service.adb.tcp.port", value, "");    if (!value[0]) {        property_get("persist.adb.tcp.port", value, "");    }    if (sscanf(value, "%d", &port) == 1 && port > 0) {        printf("using port=%d/n", port);        // listen on TCP port specified by service.adb.tcp.port property        local_init(port);    } else if (!usb) {        // listen on default port        local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT);    }    D("adb_main(): pre init_jdwp()/n");    init_jdwp();    D("adb_main(): post init_jdwp()/n");#endif    if (is_daemon)    {        // inform our parent that we are up and running.#ifdef HAVE_WIN32_PROC        DWORD  count;        WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK/n", 3, &count, NULL );#elif defined(HAVE_FORKEXEC)        fprintf(stderr, "OK/n");#endif        start_logging();    }    D("Event loop starting/n");    fdevent_loop();    usb_cleanup();    return 0;}
开发者ID:SAOSP,项目名称:platform_system_core,代码行数:101,


示例21: main

/** * /brief Main program function * * This functions parse command line options to determine Isaac behaviour * This progran can be used as a Isaac process or a CLI client * if -r option is specified. * * /param argc Argument counter * /param argv Array of string arguments passed to the program */intmain(int argc, char *argv[]){    pid_t pid;    int opt_remote = 0;    char opt;    char * xarg = NULL;    // Parse commandline arguments    while ((opt = getopt(argc, argv, "dhrvx:")) != EOF) {        switch (opt) {        case 'd':            debug++;            break;        case 'r':            opt_remote++;            break;        case 'x':            opt_execute++;            opt_remote++; // This is implicit in 'x'            xarg = strdup(optarg);            break;        case 'v':            version();            exit(EXIT_SUCCESS);        case 'h':        case '?':            usage();            exit(EXIT_SUCCESS);        }    }    // Check if there is an Isaac is already running    if (opt_remote) {        if (remote_tryconnect() == 0) {            if (!opt_execute) {                remote_control(NULL);                return 0;            } else {                remote_control(xarg);                return 0;            }        } else {            fprintf(stderr, "Unable to connect to remote Isaac (does %s exist?)/n", CLI_SOCKET);            exit(1);        }    } else {        // Check Isaac is not already running        if (access(CLI_SOCKET, F_OK) == 0) {            fprintf(stderr, "%s already running on %s. Use '%s -r' to connect/n", argv[0],                    CLI_SOCKET, argv[0]);            exit(1);        }    }    // If we are not in debug mode, then fork to background    if (!debug) {        if ((pid = fork()) < 0)            exit(1);        else if (pid > 0)            exit(0);    }    cfg_init(&config);    // Setup signal handlers    (void) signal(SIGINT, quit);    (void) signal(SIGTERM, quit);    (void) signal(SIGPIPE, SIG_IGN);    // Read configuration files    if (cfg_read(&config, CFILE) != 0) {        fprintf(stderr, "Failed to read configuration file %s/n", CFILE);        quit(EXIT_FAILURE);    }    // Initialize logging    if (start_logging(config.logtype, config.logfile, config.logtag, config.loglevel) != 0) {        fprintf(stderr, "Failed to read configuration file %s/n", CFILE);        quit(EXIT_FAILURE);    }    // Load Modules. The contain the server Applications    if (load_modules() != 0) {        quit(EXIT_FAILURE);    }    // Start manager thread    if (start_manager(config.manaddr, config.manport, config.manuser, config.manpass) != 0) {        quit(EXIT_FAILURE);//.........这里部分代码省略.........
开发者ID:irontec,项目名称:isaac,代码行数:101,


示例22: main

//.........这里部分代码省略.........		cli_classic_abort_usage();	}	if (layoutfile && check_filename(layoutfile, "layout")) {		cli_classic_abort_usage();	}	if (fmapfile && check_filename(fmapfile, "fmap")) {		cli_classic_abort_usage();	}	if (referencefile && check_filename(referencefile, "reference")) {		cli_classic_abort_usage();	}#ifndef STANDALONE	if (logfile && check_filename(logfile, "log"))		cli_classic_abort_usage();	if (logfile && open_logfile(logfile))		cli_classic_abort_usage();#endif /* !STANDALONE */#if CONFIG_PRINT_WIKI == 1	if (list_supported_wiki) {		print_supported_wiki();		goto out;	}#endif	if (list_supported) {		if (print_supported())			ret = 1;		goto out;	}#ifndef STANDALONE	start_logging();#endif /* !STANDALONE */	print_buildinfo();	msg_gdbg("Command line (%i args):", argc - 1);	for (i = 0; i < argc; i++) {		msg_gdbg(" %s", argv[i]);	}	msg_gdbg("/n");	if (layoutfile && read_romlayout(layoutfile)) {		ret = 1;		goto out;	}	if (!ifd && !fmap && process_include_args(get_global_layout())) {		ret = 1;		goto out;	}	/* Does a chip with the requested name exist in the flashchips array? */	if (chip_to_probe) {		for (chip = flashchips; chip && chip->name; chip++)			if (!strcmp(chip->name, chip_to_probe))				break;		if (!chip || !chip->name) {			msg_cerr("Error: Unknown chip '%s' specified./n", chip_to_probe);			msg_gerr("Run flashrom -L to view the hardware supported in this flashrom version./n");			ret = 1;			goto out;		}		/* Keep chip around for later usage in case a forced read is requested. */	}
开发者ID:flashrom,项目名称:flashrom,代码行数:66,


示例23: start_logging

// arm_checks - perform final checks before arming//  always called just before arming.  Return true if ok to arm//  has side-effect that logging is startedbool Copter::arm_checks(bool display_failure, bool arming_from_gcs){#if LOGGING_ENABLED == ENABLED    // start dataflash    start_logging();#endif    // check accels and gyro are healthy    if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_INS)) {        if(!ins.get_accel_health_all()) {            if (display_failure) {                gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Accelerometers not healthy"));            }            return false;        }        if(!ins.get_gyro_health_all()) {            if (display_failure) {                gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Gyros not healthy"));            }            return false;        }        // get ekf attitude (if bad, it's usually the gyro biases)        if (!pre_arm_ekf_attitude_check()) {            if (display_failure) {                gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: gyros still settling"));            }            return false;        }    }    // always check if inertial nav has started and is ready    if(!ahrs.healthy()) {        if (display_failure) {            gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Waiting for Nav Checks Arm"));        }        return false;    }    if(compass.is_calibrating()) {        if (display_failure) {            gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Compass calibration running"));        }        return false;    }    // always check if the current mode allows arming    if (!mode_allows_arming(control_mode, arming_from_gcs)) {        if (display_failure) {            gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Mode not armable"));        }        return false;    }    // always check gps    if (!pre_arm_gps_checks(display_failure)) {        return false;    }    // heli specific arming check#if FRAME_CONFIG == HELI_FRAME    // check if rotor is spinning on heli because this could disrupt gyro calibration    if (!motors.allow_arming()){        if (display_failure) {            gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Rotor is Spinning"));        }        return false;    }#endif  // HELI_FRAME    // succeed if arming checks are disabled    if (g.arming_check == ARMING_CHECK_NONE) {        return true;    }    // baro checks    if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_BARO)) {        // baro health check        if (!barometer.all_healthy()) {            if (display_failure) {                gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Barometer not healthy"));            }            return false;        }        // Check baro & inav alt are within 1m if EKF is operating in an absolute position mode.        // Do not check if intending to operate in a ground relative height mode as EKF will output a ground relative height        // that may differ from the baro height due to baro drift.        nav_filter_status filt_status = inertial_nav.get_filter_status();        bool using_baro_ref = (!filt_status.flags.pred_horiz_pos_rel && filt_status.flags.pred_horiz_pos_abs);        if (using_baro_ref && (fabsf(inertial_nav.get_altitude() - baro_alt) > PREARM_MAX_ALT_DISPARITY_CM)) {            if (display_failure) {                gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Arm: Altitude disparity"));            }            return false;        }    }#if AC_FENCE == ENABLED    // check vehicle is within fence//.........这里部分代码省略.........
开发者ID:JavaGrinko,项目名称:coopter,代码行数:101,


示例24: server_init

int server_init (int argc, char *argv[]){    int  ret;    char filename[512];    char pbuf[1024];    switch (_parse_config_opts (argc, argv, filename, 512))    {        case -1:            _print_usage();            return -1;        default:            /* parse the config file */            config_get_config();            ret = config_initial_parse_file(filename);            config_release_config();            if (ret < 0)            {                snprintf (pbuf, sizeof(pbuf),                         "FATAL: error parsing config file (%s)", filename);                _fatal_error (pbuf);                switch (ret)                {                    case CONFIG_EINSANE:                        _fatal_error("filename was null or blank");                        break;                    case CONFIG_ENOROOT:                        _fatal_error("no root element found");                        break;                    case CONFIG_EBADROOT:                        _fatal_error("root element is not <icecast>");                        break;                    default:                        _fatal_error("XML config parsing error");                        break;                }                return -1;            }    }    /* override config file options with commandline options */    config_parse_cmdline(argc, argv);    /* Bind socket, before we change userid */    if (_server_proc_init() == 0)    {        _fatal_error("Server startup failed. Exiting");        return -1;    }    fserve_initialize();#ifdef CHUID     /* We'll only have getuid() if we also have setuid(), it's reasonable to     * assume */    if (getuid() == 0) /* Running as root! Don't allow this */    {        fprintf (stderr, "ERROR: You should not run icecast2 as root/n");        fprintf (stderr, "Use the changeowner directive in the config file/n");        return -1;    }#endif    /* setup default signal handlers */    sighandler_initialize();    if (start_logging (config_get_config_unlocked()) < 0)    {        _fatal_error("FATAL: Could not start logging");        return -1;    }    return 0;}
开发者ID:niko,项目名称:icecast-kh,代码行数:71,


示例25: main

intmain(int argc, char *argv[]){    int c;    int scan_lev;    struct np_event *e;    enum np_event_type etype;    (void) setlocale(LC_ALL, "");    (void) textdomain(TEXT_DOMAIN);    shutting_down = B_FALSE;    start_logging();    syslog(LOG_INFO, "nwamd pid %d started", getpid());    while ((c = getopt(argc, argv, "fs:")) != -1) {        switch (c) {        case 'f':            fg = B_TRUE;            break;        case 's':            scan_lev = atoi(optarg);            if (scan_lev >= DLADM_WLAN_STRENGTH_VERY_WEAK &&                    scan_lev <= DLADM_WLAN_STRENGTH_EXCELLENT) {                wireless_scan_level = scan_lev;            } else {                syslog(LOG_ERR, "invalid signal "                       "strength: %s", optarg);            }            break;        default:            syslog(LOG_ERR, "unrecognized option %c",                   optopt);            break;        }    }    lookup_daemon_properties();    /*     * The dladm handle *must* be opened before privileges are dropped     * by nwamd.  The device privilege requirements from     * /etc/security/device_policy may not be loaded yet.  These are     * loaded by svc:/system/filesystem/root, which comes online after     * svc:/network/physical.     */    if (dladm_open(&dld_handle) != DLADM_STATUS_OK) {        syslog(LOG_ERR, "failed to open dladm handle");        exit(EXIT_FAILURE);    }    change_user_set_privs();    if (!fg)        daemonize();    initialize_llp();    init_signalhandling();    initialize_wireless();    lookup_zonename(zonename, sizeof (zonename));    init_machine_mutex();    initialize_interfaces();    llp_parse_config();    initialize_door();    (void) start_event_collection();    while ((e = np_queue_get_event()) != NULL) {        etype = e->npe_type;        syslog(LOG_INFO, "got event type %s", npe_type_str(etype));        if (etype == EV_SHUTDOWN)            terminate_door();        if (pthread_mutex_lock(&machine_lock) != 0) {            syslog(LOG_ERR, "mutex lock");            exit(EXIT_FAILURE);        }        state_machine(e);        (void) pthread_mutex_unlock(&machine_lock);        free_event(e);        if (etype == EV_SHUTDOWN)            break;    }    syslog(LOG_DEBUG, "terminating routing and scanning threads");    (void) pthread_cancel(routing);    (void) pthread_join(routing, NULL);    if (scan != 0) {        (void) pthread_cancel(scan);        (void) pthread_join(scan, NULL);    }    dladm_close(dld_handle);    syslog(LOG_INFO, "nwamd shutting down");    return (EXIT_SUCCESS);//.........这里部分代码省略.........
开发者ID:CoryXie,项目名称:opensolaris,代码行数:101,


示例26: adb_main

//.........这里部分代码省略.........            // service.adb.root property has been set by the "adb root" command            property_get("ro.debuggable", value, "");            if (strcmp(value, "1") == 0) {                property_get("service.adb.root", value, "");                if (strcmp(value, "1") == 0) {                    secure = 0;                }            }        }    }    /* don't listen on a port (default 5037) if running in secure mode */    /* don't run as root if we are running in secure mode */    if (secure) {        struct __user_cap_header_struct header;        struct __user_cap_data_struct cap;        if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0) {            exit(1);        }        /* add extra groups:        ** AID_ADB to access the USB driver        ** AID_LOG to read system logs (adb logcat)        ** AID_INPUT to diagnose input issues (getevent)        ** AID_INET to diagnose network issues (netcfg, ping)        ** AID_GRAPHICS to access the frame buffer        ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)        ** AID_SDCARD_RW to allow writing to the SD card        ** AID_MOUNT to allow unmounting the SD card before rebooting        */        gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS,                           AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_RW, AID_MOUNT };        if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {            exit(1);        }        /* then switch user and group to "shell" */        if (setgid(AID_SHELL) != 0) {            exit(1);        }        if (setuid(AID_SHELL) != 0) {            exit(1);        }        /* set CAP_SYS_BOOT capability, so "adb reboot" will succeed */        header.version = _LINUX_CAPABILITY_VERSION;        header.pid = 0;        cap.effective = cap.permitted = (1 << CAP_SYS_BOOT);        cap.inheritable = 0;        capset(&header, &cap);        D("Local port disabled/n");    } else {        char local_name[30];        build_local_name(local_name, sizeof(local_name), server_port);        if(install_listener(local_name, "*smartsocket*", NULL)) {            exit(1);        }    }        /* for the device, start the usb transport if the        ** android usb device exists and the "service.adb.tcp.port" and        ** "persist.adb.tcp.port" properties are not set.        ** Otherwise start the network transport.        */    property_get("service.adb.tcp.port", value, "");    if (!value[0])        property_get("persist.adb.tcp.port", value, "");    if (sscanf(value, "%d", &port) == 1 && port > 0) {        // listen on TCP port specified by service.adb.tcp.port property        local_init(port);    } else if (access("/dev/android_adb", F_OK) == 0) {        // listen on USB        usb_init();    } else {        // listen on default port        local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT);    }    init_jdwp();#endif    if (is_daemon)    {        // inform our parent that we are up and running.#ifdef HAVE_WIN32_PROC        DWORD  count;        WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK/n", 3, &count, NULL );#elif defined(HAVE_FORKEXEC)        fprintf(stderr, "OK/n");#endif        start_logging();    }    fdevent_loop();    usb_cleanup();    return 0;}
开发者ID:2fast4u88,项目名称:oxygen_system_core,代码行数:101,


示例27: start_logging

 void Environment::restart_logging(STATE) {   logger::close();   start_logging(state); }
开发者ID:sodabrew,项目名称:rubinius,代码行数:4,


示例28: main

int main(int argc, char** argv){    /* I18n */    setlocale(LC_ALL, "");#if ENABLE_NLS    bindtextdomain(PACKAGE, LOCALEDIR);    textdomain(PACKAGE);#endif    abrt_init(argv);    int parent_pid = getpid();    const char *program_usage_string = _(        "& [options]"    );    enum {        OPT_v = 1 << 0,        OPT_d = 1 << 1,        OPT_s = 1 << 2,// TODO: get rid of -t NUM, it is no longer useful since dbus is moved to a separate tool        OPT_t = 1 << 3,        OPT_p = 1 << 4,    };    /* Keep enum above and order of options below in sync! */    struct options program_options[] = {        OPT__VERBOSE(&g_verbose),        OPT_BOOL(   'd', NULL, NULL      , _("Do not daemonize")),        OPT_BOOL(   's', NULL, NULL      , _("Log to syslog even with -d")),        OPT_INTEGER('t', NULL, &s_timeout, _("Exit after NUM seconds of inactivity")),        OPT_BOOL(   'p', NULL, NULL      , _("Add program names to log")),        OPT_END()    };    unsigned opts = parse_opts(argc, argv, program_options, program_usage_string);    export_abrt_envvars(opts & OPT_p);#if 0 /* We no longer use dbus */    /* When dbus daemon starts us, it doesn't set PATH     * (I saw it set only DBUS_STARTER_ADDRESS and DBUS_STARTER_BUS_TYPE).     * In this case, set something sane:     */    const char *env_path = getenv("PATH");    if (!env_path || !env_path[0])        putenv((char*)"PATH=/usr/sbin:/usr/bin:/sbin:/bin");#endif    unsetenv("ABRT_SYSLOG");    msg_prefix = g_progname; /* for log_warning(), error_msg() and such */    if (getuid() != 0)        error_msg_and_die("Must be run as root");    if (opts & OPT_s)        start_logging();    xpipe(s_signal_pipe);    close_on_exec_on(s_signal_pipe[0]);    close_on_exec_on(s_signal_pipe[1]);    ndelay_on(s_signal_pipe[0]); /* I/O should not block - */    ndelay_on(s_signal_pipe[1]); /* especially writes! they happen in signal handler! */    signal(SIGTERM, handle_signal);    signal(SIGINT,  handle_signal);    signal(SIGCHLD, handle_signal);    GIOChannel* channel_signal = NULL;    guint channel_id_signal_event = 0;    bool pidfile_created = false;    struct abrt_inotify_watch *aiw = NULL;    int ret = 1;    /* Initialization */    log_notice("Loading settings");    if (load_abrt_conf() != 0)        goto init_error;    /* Moved before daemonization because parent waits for signal from daemon     * only for short period and time consumed by     * mark_unprocessed_dump_dirs_not_reportable() is slightly unpredictable.     */    sanitize_dump_dir_rights();    mark_unprocessed_dump_dirs_not_reportable(g_settings_dump_location);    /* Daemonize unless -d */    if (!(opts & OPT_d))    {        /* forking to background */        fflush(NULL); /* paranoia */        pid_t pid = fork();        if (pid < 0)        {            perror_msg_and_die("fork");        }        if (pid > 0)        {            /* Parent */            /* Wait for child to notify us via SIGTERM that it feels ok */            int i = 20; /* 2 sec */            while (s_sig_caught == 0 && --i)            {//.........这里部分代码省略.........
开发者ID:wlindauer,项目名称:abrt,代码行数:101,


示例29: start_logging

// arm_checks - perform final checks before arming//  always called just before arming.  Return true if ok to arm//  has side-effect that logging is startedbool Copter::arm_checks(bool display_failure, bool arming_from_gcs){    #if LOGGING_ENABLED == ENABLED    // start dataflash    start_logging();    #endif    // check accels and gyro are healthy    if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_INS)) {        //check if accelerometers have calibrated and require reboot        if (ins.accel_cal_requires_reboot()) {            if (display_failure) {                gcs_send_text(MAV_SEVERITY_CRITICAL, "PreArm: Accelerometers calibrated requires reboot");            }            return false;        }        if (!ins.get_accel_health_all()) {            if (display_failure) {                gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: Accelerometers not healthy");            }            return false;        }        if (!ins.get_gyro_health_all()) {            if (display_failure) {                gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: Gyros not healthy");            }            return false;        }        // get ekf attitude (if bad, it's usually the gyro biases)        if (!pre_arm_ekf_attitude_check()) {            if (display_failure) {                gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: gyros still settling");            }            return false;        }    }    // always check if inertial nav has started and is ready    if (!ahrs.healthy()) {        if (display_failure) {            gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: Waiting for Nav Checks");        }        return false;    }    if (compass.is_calibrating()) {        if (display_failure) {            gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: Compass calibration running");        }        return false;    }    //check if compass has calibrated and requires reboot    if (compass.compass_cal_requires_reboot()) {        if (display_failure) {            gcs_send_text(MAV_SEVERITY_CRITICAL, "PreArm: Compass calibrated requires reboot");        }        return false;    }    // always check if the current mode allows arming    if (!mode_allows_arming(control_mode, arming_from_gcs)) {        if (display_failure) {            gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: Mode not armable");        }        return false;    }    // always check gps    if (!pre_arm_gps_checks(display_failure)) {        return false;    }    // if we are using motor interlock switch and it's enabled, fail to arm    // skip check in Throw mode which takes control of the motor interlock    if (ap.using_interlock && motors.get_interlock()) {        gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: Motor Interlock Enabled");        return false;    }    // if we are not using Emergency Stop switch option, force Estop false to ensure motors    // can run normally    if (!check_if_auxsw_mode_used(AUXSW_MOTOR_ESTOP)){        set_motor_emergency_stop(false);        // if we are using motor Estop switch, it must not be in Estop position    } else if (check_if_auxsw_mode_used(AUXSW_MOTOR_ESTOP) && ap.motor_emergency_stop){        gcs_send_text(MAV_SEVERITY_CRITICAL,"Arm: Motor Emergency Stopped");        return false;    }    // succeed if arming checks are disabled    if (g.arming_check == ARMING_CHECK_NONE) {        return true;    }    // baro checks//.........这里部分代码省略.........
开发者ID:2013-8-15,项目名称:ardupilot,代码行数:101,


示例30: adb_main

//.........这里部分代码省略.........    atexit(adb_cleanup);#ifdef HAVE_WIN32_PROC    SetConsoleCtrlHandler( ctrlc_handler, TRUE );#elif defined(HAVE_FORKEXEC)    signal(SIGCHLD, sigchld_handler);    signal(SIGPIPE, SIG_IGN);#endif    init_transport_registration();#if ADB_HOST    HOST = 1;    usb_init();    local_init();    if(install_listener("tcp:5037", "*smartsocket*", NULL)) {        exit(1);    }#else    /* run adbd in secure mode if ro.secure is set and    ** we are not in the emulator    */    property_get("ro.kernel.qemu", value, "");    if (strcmp(value, "1") != 0) {        property_get("ro.secure", value, "");        if (strcmp(value, "1") == 0) {            // don't run as root if ro.secure is set...            secure = 1;            // ... except we allow running as root in userdebug builds if the            // service.adb.root property has been set by the "adb root" command            property_get("ro.debuggable", value, "");            if (strcmp(value, "1") == 0) {                property_get("service.adb.root", value, "");                if (strcmp(value, "1") == 0) {                    secure = 0;                }            }        }    }    /* don't listen on port 5037 if we are running in secure mode */    /* don't run as root if we are running in secure mode */    if (secure) {        /* add extra groups:        ** AID_ADB to access the USB driver        ** AID_LOG to read system logs (adb logcat)        ** AID_INPUT to diagnose input issues (getevent)        ** AID_INET to diagnose network issues (netcfg, ping)        ** AID_GRAPHICS to access the frame buffer        ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)        */        gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS,                           AID_NET_BT, AID_NET_BT_ADMIN                         };        setgroups(sizeof(groups)/sizeof(groups[0]), groups);        /* then switch user and group to "shell" */        setgid(AID_SHELL);        setuid(AID_SHELL);        D("Local port 5037 disabled/n");    } else {        if(install_listener("tcp:5037", "*smartsocket*", NULL)) {            exit(1);        }    }    /* for the device, start the usb transport if the    ** android usb device exists, otherwise start the    ** network transport.    */    if(access("/dev/android_adb", F_OK) == 0 ||            access("/dev/android", F_OK) == 0) {        usb_init();    } else {        local_init();    }    init_jdwp();#endif    if (is_daemon)    {        // inform our parent that we are up and running.#ifdef HAVE_WIN32_PROC        DWORD  count;        WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK/n", 3, &count, NULL );#elif defined(HAVE_FORKEXEC)        fprintf(stderr, "OK/n");#endif        start_logging();    }    fdevent_loop();    usb_cleanup();    return 0;}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:101,



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


C++ start_other_cores函数代码示例
C++ start_iMCU_row函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。