コード例 #1
0
void InspectorDOMStorageAgent::restore() {
  if (m_state->booleanProperty(DOMStorageAgentState::domStorageAgentEnabled,
                               false)) {
    enable();
  }
}
コード例 #2
0
void InspectorResourceAgent::restore()
{
    if (m_state->getBoolean(ResourceAgentState::resourceAgentEnabled))
        enable();
}
コード例 #3
0
ファイル: main.c プロジェクト: denever/shell-fm
int main(int argc, char ** argv) {
    int option, nerror = 0, background = 0, haveSocket = 0;
    time_t pauselength = 0;
    char * proxy;
    opterr = 0;

    /* Create directories. */
    makercd();

    /* Load settings from ~/.shell-fm/shell-fm.rc. */
    settings(rcpath("shell-fm.rc"), !0);

    /* Enable discovery by default if it is set in configuration. */
    if(haskey(& rc, "discovery"))
        enable(DISCOVERY);

    /* Get proxy environment variable. */
    if((proxy = getenv("http_proxy")) != NULL)
        set(& rc, "proxy", proxy);


    /* Parse through command line options. */
    while(-1 != (option = getopt(argc, argv, ":dbhi:p:D:y:")))
        switch(option) {
        case 'd': /* Daemonize. */
            background = !0;
            break;

        case 'i': /* IP to bind network interface to. */
            set(& rc, "bind", optarg);
            break;

        case 'p': /* Port to listen on. */
            if(atoi(optarg))
                set(& rc, "port", optarg);
            else {
                fputs("Invalid port.\n", stderr);
                ++nerror;
            }
            break;

        case 'b': /* Batch mode */
            batch = !0;
            break;

        case 'D': /* Path to audio device file. */
            set(& rc, "device", optarg);
            break;

        case 'y': /* Proxy address. */
            set(& rc, "proxy", optarg);
            break;

        case 'h': /* Print help text and exit. */
            help(argv[0], 0);
            break;

        case ':':
            fprintf(stderr, "Missing argument for option -%c.\n\n", optopt);
            ++nerror;
            break;

        case '?':
        default:
            fprintf(stderr, "Unknown option -%c.\n", optopt);
            ++nerror;
            break;
        }

    /* The next argument, if present, is the lastfm:// URL we want to play. */
    if(optind > 0 && optind < argc && argv[optind]) {
        const char * station = argv[optind];

        if(0 != strncmp(station, "lastfm://", 9)) {
            fprintf(stderr, "Not a valid lastfm url: %s\n\n", station);
            ++nerror;
        } else {
            set(& rc, "default-radio", station);
        }
    }


    if(nerror)
        help(argv[0], EXIT_FAILURE);

#ifndef LIBAO
    if(!haskey(& rc, "device"))
        set(& rc, "device", "/dev/audio");
#endif

    if(!background) {
        puts("Shell.FM v" PACKAGE_VERSION ", (C) 2006-2009 by Jonas Kramer");
        puts("Published under the terms of the GNU General Public License (GPL).");

#ifndef TUXBOX
        puts("\nPress ? for help.\n");
#else
        puts("Compiled for the use with Shell.FM Wrapper.\n");
#endif
        fflush(stdout);
    }


    /* Open a port so Shell.FM can be controlled over network. */
    if(haskey(& rc, "bind")) {
        int port = 54311;

        if(haskey(& rc, "port"))
            port = atoi(value(& rc, "port"));

        if(tcpsock(value(& rc, "bind"), (unsigned short) port))
            haveSocket = !0;
    }


    /* Open a UNIX socket for local "remote" control. */
    if(haskey(& rc, "unix") && unixsock(value(& rc, "unix")))
        haveSocket = !0;


    /* We can't daemonize if there's no possibility left to control Shell.FM. */
    if(background && !haveSocket) {
        fputs("Can't daemonize without control socket.\n", stderr);
        exit(EXIT_FAILURE);
    }


    /* Ask for username/password if they weren't specified in the .rc file. */
    if(!haskey(& rc, "password")) {
        char * password;

        if(!haskey(& rc, "username")) {
            char username[256] = { 0 };

            struct prompt prompt = {
                .prompt = "Login: "******"USER"), .history = NULL, .callback = NULL,
            };

            strncpy(username, readline(& prompt), 255);

            set(& rc, "username", username);
        }

        if(!(password = getpass("Password: "******"password", password);
    }
コード例 #4
0
void FlightSimClass::update(void)
{
	uint8_t len, maxlen, type, *p, *end;
	union {
		uint8_t b[4];
		long l;
		float f;
	} data;
	usb_packet_t *rx_packet;
	uint16_t id;

	while (1) {
		if (!usb_configuration) break;
		rx_packet = usb_rx(FLIGHTSIM_RX_ENDPOINT);
		if (!rx_packet) break;
		p = rx_packet->buf;
		end = p + 64;
		maxlen = 64;
		do {
			len = p[0];
			if (len < 2 || len > maxlen) break;
			switch (p[1]) {
			  case 0x02: // write data
				if (len < 10) break;
				id = p[2] | (p[3] << 8);
				type = p[4];
				if (type == 1) {
					FlightSimInteger *item = FlightSimInteger::find(id);
					if (!item) break;
					#ifdef KINETISK
					data.l = *(long *)(p + 6);
					#else
					data.b[0] = p[6];
					data.b[1] = p[7];
					data.b[2] = p[8];
					data.b[3] = p[9];
					#endif
					item->update(data.l);
				} else if (type == 2) {
					FlightSimFloat *item = FlightSimFloat::find(id);
					if (!item) break;
					#ifdef KINETISK
					data.f = *(float *)(p + 6);
					#else
					data.b[0] = p[6];
					data.b[1] = p[7];
					data.b[2] = p[8];
					data.b[3] = p[9];
					#endif
					item->update(data.f);
				}
				break;
			  case 0x03: // enable/disable
				if (len < 4) break;
				switch (p[2]) {
				  case 1:
					request_id_messages = 1;
				  case 2:
					enable();
					frameCount++;
					break;
				  case 3:
					disable();
				}
			}
			p += len;
			maxlen -= len;
		} while (p < end);
		usb_free(rx_packet);
	}
	if (enabled && request_id_messages) {
		request_id_messages = 0;
		for (FlightSimCommand *p = FlightSimCommand::first; p; p = p->next) {
			p->identify();
		}
		for (FlightSimInteger *p = FlightSimInteger::first; p; p = p->next) {
			p->identify();
			// TODO: send any dirty data
		}
		for (FlightSimFloat *p = FlightSimFloat::first; p; p = p->next) {
			p->identify();
			// TODO: send any dirty data
		}
	}
}
コード例 #5
0
void InspectorDOMStorageAgent::restore()
{
    if (isEnabled())
        enable(0);
}
コード例 #6
0
 /**
  * @brief Mark config manager as enabled module
  */
 void enableConfigManager()
 {
     enable(CONFIG_MANAGER);
 }
コード例 #7
0
ファイル: Surface.cpp プロジェクト: thinlizzy/die-tk
void Surface::setEnabled(bool enabled)
{
    if( enabled ) enable(); else disable();
}
コード例 #8
0
ファイル: Cin.cpp プロジェクト: JERUKA9/ffdshow-tryouts
void TinPage::incsp2dlg(void)
{
    setCheck(IDC_CHB_FORCEINCSP,cfgGet(IDFF_enc_forceIncsp));
    enable(cfgGet(IDFF_enc_forceIncsp),IDC_CBX_INCSP);
    cbxSetDataCurSel(IDC_CBX_INCSP,cfgGet(IDFF_enc_incsp));
}
コード例 #9
0
ファイル: Cin.cpp プロジェクト: JERUKA9/ffdshow-tryouts
void TinPage::interlaced2dlg(void)
{
    setCheck(IDC_CHB_DY_INTERLACED,cfgGet(IDFF_isDyInterlaced));
    SetDlgItemInt(m_hwnd,IDC_ED_DY_INTERLACED,cfgGet(IDFF_dyInterlaced),FALSE);
    enable(cfgGet(IDFF_isDyInterlaced),IDC_ED_DY_INTERLACED);
}
コード例 #10
0
ファイル: faskbhit.c プロジェクト: Eric-Schnipke/snippets
void fast_kbflush_dos(void)
{
      disable();
      HEAD = TAIL;
      enable();
}
コード例 #11
0
ファイル: MPU6050Sensor.cpp プロジェクト: qqedfr/kitkat-2
MPU6050Sensor::~MPU6050Sensor() {
    if (mEnabled) {
        enable(ID_A, 0);
        enable(ID_GY, 0);
    }
}
コード例 #12
0
    void logger::init(Facility facility, bitset<8>mask)
    {
#ifdef _WIN32
        WinLog::Create(ident);
#else
        int fac = LOG_DAEMON;
        switch (facility) {
            case AUTH:
                fac = LOG_AUTH;
                break;
            case AUTHPRIV:
                fac = LOG_AUTHPRIV;
                break;
            case CRON:
                fac = LOG_CRON;
                break;
            case DAEMON:
            default:
                fac = LOG_DAEMON;
                break;
            case FTP:
                fac = LOG_FTP;
                break;
            case KERN:
                fac = LOG_KERN;
                break;
            case LOCAL0:
                fac = LOG_LOCAL0;
                break;
            case LOCAL1:
                fac = LOG_LOCAL1;
                break;
            case LOCAL2:
                fac = LOG_LOCAL2;
                break;
            case LOCAL3:
                fac = LOG_LOCAL3;
                break;
            case LOCAL4:
                fac = LOG_LOCAL4;
                break;
            case LOCAL5:
                fac = LOG_LOCAL5;
                break;
            case LOCAL6:
                fac = LOG_LOCAL6;
                break;
            case LOCAL7:
                fac = LOG_LOCAL7;
                break;
            case LPR:
                fac = LOG_LPR;
                break;
            case MAIL:
                fac = LOG_MAIL;
                break;
            case NEWS:
                fac = LOG_NEWS;
                break;
            case SYSLOG:
                fac = LOG_SYSLOG;
                break;
            case USER:
                fac = LOG_USER;
                break;
            case UUCP:
                fac = LOG_UUCP;
                break;
        }
        openlog(ident, LOG_PID|LOG_NDELAY, fac);
        // cout << "openlog('" << ident << "', LOG_PID|LOG_NDELAY," << hex << fac << dec << ")" << endl;
#endif
        setmask(mask);
        enable();
    }
コード例 #13
0
ファイル: vo_s3fb.c プロジェクト: Gamer125/wiibrowser
static int preinit(const char *arg)
{
  char *name;

  if(arg)
    name = (char*)arg;
  else if(!(name = getenv("FRAMEBUFFER")))
    name = "/dev/fb0";

  if((fd = open(name, O_RDWR)) == -1) {
    mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: can't open %s: %s\n", name, strerror(errno));
    return -1;
  }

  if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
    mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: problem with FBITGET_FSCREENINFO ioctl: %s\n",
           strerror(errno));
    close(fd);
    fd = -1;
    return -1;
  }

  if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
    mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: problem with FBITGET_VSCREENINFO ioctl: %s\n",
           strerror(errno));
    close(fd);
    fd = -1;
    return -1;
  }

  // Check the depth now as config() musn't fail
  switch(fb_vinfo.bits_per_pixel) {
  case 16:
  case 24:
  case 32:
    break; // Ok
  default:
    mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: %d bpp output is not supported\n", fb_vinfo.bits_per_pixel);
    close(fd);
    fd = -1;
    return -1;
  }

  /* Open up a window to the hardware */
  smem = mmap(0, fb_finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  sreg = fb_finfo.smem_start;

  if(smem == (void *)-1) {
    mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Couldn't map memory areas: %s\n", strerror(errno));
    smem = NULL;
    close(fd);
    fd = -1;
    return -1;
  }

  if (!enable()) {
    mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Couldn't map S3 registers: %s\n", strerror(errno));
    close(fd);
    fd = -1;
    return -1;
  }

  return 0; // Success
}
コード例 #14
0
ファイル: webrtcprotection.cpp プロジェクト: AzanovAA/VPNht
WebRTCProtection::~WebRTCProtection()
{
    enable(false);
}
コード例 #15
0
bool ExtManager::disable(const char*   name) { return enable(name, false); }
コード例 #16
0
/*-----------------------------------------------------------*/
void vHTTPTask( void * pvParameters )
{
short i, sLen;
unsigned char ucState;

	( void ) pvParameters;

    /* Create the semaphore used to communicate between this task and the
    WIZnet ISR. */
    vSemaphoreCreateBinary( xTCPSemaphore );

	/* Make sure everything is setup before we start. */
	prvNetifInit();
	prvHTTPInit();

	for( ;; )
	{
		/* Wait until the ISR tells us there is something to do. */
    	xSemaphoreTake( xTCPSemaphore, portMAX_DELAY );

		/* Check each socket. */
		for( i = 0; i < httpSOCKET_NUM; i++ )
		{
			ucState = select( i, SEL_CONTROL );

			switch (ucState)
			{
				case SOCK_ESTABLISHED :  /* new connection established. */

					if( ( sLen = select( i, SEL_RECV ) ) > 0 )
					{
						if( sLen > httpSOCKET_BUFFER_SIZE )
						{
							sLen = httpSOCKET_BUFFER_SIZE;
						}

						disable();

						sLen = recv( i, ucSocketBuffer, sLen );

						if( ucConnection[ i ] == 1 )
						{
							/* This is our first time processing a HTTP
							 request on this connection. */
							prvTransmitHTTP( i );
							ucConnection[i] = 0;
						}
						enable();
					}
					break;

				case SOCK_CLOSE_WAIT :

					close(i);
					break;

				case SOCK_CLOSED :

					ucConnection[i] = 1;
					socket( i, SOCK_STREAM, 80, 0x00 );
					NBlisten( i ); /* reinitialize socket. */
					break;
			}
		}
	}
}
コード例 #17
0
bool ExtManager::disable(const string& name) { return enable(name, false); }
コード例 #18
0
void InspectorProfilerAgent::enable(ErrorString*)
{
    if (enabled())
        return;
    enable(false);
}
コード例 #19
0
ファイル: oshmem_shmem_init.c プロジェクト: Slbomber/ompi
static int _shmem_init(int argc, char **argv, int requested, int *provided)
{
    int ret = OSHMEM_SUCCESS;
    char *error = NULL;

    if (OSHMEM_SUCCESS != (ret = oshmem_proc_init())) {
        error = "oshmem_proc_init() failed";
        goto error;
    }

    /* We need to do this anyway.
     * This place requires to be reviewed and more elegant way is expected
     */
    ompi_proc_local_proc = (ompi_proc_t*) oshmem_proc_local_proc;

    /* Register the OSHMEM layer's MCA parameters */
    if (OSHMEM_SUCCESS != (ret = oshmem_shmem_register_params())) {
        error = "oshmem_info_register: oshmem_register_params failed";
        goto error;
    }
    /* Setting verbosity for macros like SHMEM_API_VERBOSE, SHMEM_API_ERROR.
     * We need to set it right after registering mca verbosity variables
     */
    shmem_api_logger_output = opal_output_open(NULL);
    opal_output_set_verbosity(shmem_api_logger_output,
                              oshmem_shmem_api_verbose);

    if (OSHMEM_SUCCESS != (ret = oshmem_group_cache_list_init())) {
        error = "oshmem_group_cache_list_init() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = oshmem_op_init())) {
        error = "oshmem_op_init() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_spml_base_framework, MCA_BASE_OPEN_DEFAULT))) {
        error = "mca_spml_base_open() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_scoll_base_framework, MCA_BASE_OPEN_DEFAULT))) {
        error = "mca_scoll_base_open() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS
            != (ret = mca_spml_base_select(OPAL_ENABLE_PROGRESS_THREADS,
                                           OMPI_ENABLE_THREAD_MULTIPLE))) {
        error = "mca_spml_base_select() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS
            != (ret =
                    mca_scoll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
                                                  OMPI_ENABLE_THREAD_MULTIPLE))) {
        error = "mca_scoll_base_find_available() failed";
        goto error;
    }

    /* Initialize each SHMEM handle subsystem */
    /* Initialize requests */
    if (OSHMEM_SUCCESS != (ret = oshmem_request_init())) {
        error = "oshmem_request_init() failed";
        goto error;
    }

    /* identify the architectures of remote procs and setup
     * their datatype convertors, if required
     */
    if (OSHMEM_SUCCESS != (ret = oshmem_proc_set_arch())) {
        error = "oshmem_proc_set_arch failed";
        goto error;
    }

    /* start SPML/BTL's */
    ret = MCA_SPML_CALL(enable(true));
    if (OSHMEM_SUCCESS != ret) {
        error = "SPML control failed";
        goto error;
    }

    /* There is issue with call add_proc twice so
     * we need to use btl info got from PML add_procs() before call of SPML add_procs()
     */
    {
        ompi_proc_t** procs = NULL;
        size_t nprocs = 0;
        procs = ompi_proc_world(&nprocs);
        while (nprocs--) {
            oshmem_group_all->proc_array[nprocs]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML] =
                    procs[nprocs]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML];
        }
        free(procs);
    }

    ret =
            MCA_SPML_CALL(add_procs(oshmem_group_all->proc_array, oshmem_group_all->proc_count));
    if (OSHMEM_SUCCESS != ret) {
        error = "SPML add procs failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_sshmem_base_framework, MCA_BASE_OPEN_DEFAULT))) {
        error = "mca_sshmem_base_open() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = mca_sshmem_base_select())) {
        error = "mca_sshmem_base_select() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_memheap_base_framework, MCA_BASE_OPEN_DEFAULT))) {
        error = "mca_memheap_base_open() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = mca_memheap_base_select())) {
        error = "mca_memheap_base_select() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_atomic_base_framework, MCA_BASE_OPEN_DEFAULT))) {
        error = "mca_atomic_base_open() failed";
        goto error;
    }

    if (OSHMEM_SUCCESS
            != (ret =
                    mca_atomic_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
                                                   OMPI_ENABLE_THREAD_MULTIPLE))) {
        error = "mca_atomic_base_find_available() failed";
        goto error;
    }

    /* This call should be done after memheap initialization */
    if (OSHMEM_SUCCESS != (ret = mca_scoll_enable())) {
        error = "mca_scoll_enable() failed";
        goto error;
    }

    error: if (ret != OSHMEM_SUCCESS) {
        const char *err_msg = opal_strerror(ret);
        orte_show_help("help-shmem-runtime.txt",
                       "shmem_init:startup:internal-failure",
                       true,
                       "SHMEM_INIT",
                       "SHMEM_INIT",
                       error,
                       err_msg,
                       ret);
        return ret;
    }

    return ret;
}
コード例 #20
0
ファイル: TSL2771Sensor.cpp プロジェクト: aosp/blaze_tablet
TSL2771Sensor::~TSL2771Sensor() {
    if (mEnabled) {
        enable(ID_L, 0);
        enable(ID_P, 0);
    }
}
コード例 #21
0
ファイル: ompi_mpi_init.c プロジェクト: Zhiming-Wang/ompi
int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
{
    int ret;
    ompi_proc_t** procs;
    size_t nprocs;
    char *error = NULL;
    char *cmd=NULL, *av=NULL;
    OPAL_TIMING_DECLARE(tm);
    OPAL_TIMING_INIT_EXT(&tm, OPAL_TIMING_GET_TIME_OF_DAY);

    /* bitflag of the thread level support provided. To be used
     * for the modex in order to work in heterogeneous environments. */
    uint8_t threadlevel_bf;

    /* Indicate that we have *started* MPI_INIT*.  MPI_FINALIZE has
       something sorta similar in a static local variable in
       ompi_mpi_finalize(). */
    ompi_mpi_init_started = true;

    /* Setup enough to check get/set MCA params */

    if (OPAL_SUCCESS != (ret = opal_init_util(&argc, &argv))) {
        error = "ompi_mpi_init: opal_init_util failed";
        goto error;
    }

    /* Convince OPAL to use our naming scheme */
    opal_process_name_print = _process_name_print_for_opal;
    opal_compare_proc = _process_name_compare;

    /* Register MCA variables */
    if (OPAL_SUCCESS != (ret = ompi_register_mca_variables())) {
        error = "ompi_mpi_init: ompi_register_mca_variables failed";
        goto error;
    }

    if (OPAL_SUCCESS != (ret = opal_arch_set_fortran_logical_size(sizeof(ompi_fortran_logical_t)))) {
        error = "ompi_mpi_init: opal_arch_set_fortran_logical_size failed";
        goto error;
    }

    /* _After_ opal_init_util() but _before_ orte_init(), we need to
       set an MCA param that tells libevent that it's ok to use any
       mechanism in libevent that is available on this platform (e.g.,
       epoll and friends).  Per opal/event/event.s, we default to
       select/poll -- but we know that MPI processes won't be using
       pty's with the event engine, so it's ok to relax this
       constraint and let any fd-monitoring mechanism be used. */

    ret = mca_base_var_find("opal", "event", "*", "event_include");
    if (ret >= 0) {
        char *allvalue = "all";
        /* We have to explicitly "set" the MCA param value here
           because libevent initialization will re-register the MCA
           param and therefore override the default. Setting the value
           here puts the desired value ("all") in different storage
           that is not overwritten if/when the MCA param is
           re-registered. This is unless the user has specified a different
           value for this MCA parameter. Make sure we check to see if the
           default is specified before forcing "all" in case that is not what
           the user desires. Note that we do *NOT* set this value as an
           environment variable, just so that it won't be inherited by
           any spawned processes and potentially cause unintented
           side-effects with launching RTE tools... */
        mca_base_var_set_value(ret, allvalue, 4, MCA_BASE_VAR_SOURCE_DEFAULT, NULL);
    }

    OPAL_TIMING_MSTART((&tm,"time from start to completion of rte_init"));

    /* if we were not externally started, then we need to setup
     * some envars so the MPI_INFO_ENV can get the cmd name
     * and argv (but only if the user supplied a non-NULL argv!), and
     * the requested thread level
     */
    if (NULL == getenv("OMPI_COMMAND") && NULL != argv && NULL != argv[0]) {
        asprintf(&cmd, "OMPI_COMMAND=%s", argv[0]);
        putenv(cmd);
    }
    if (NULL == getenv("OMPI_ARGV") && 1 < argc) {
        char *tmp;
        tmp = opal_argv_join(&argv[1], ' ');
        asprintf(&av, "OMPI_ARGV=%s", tmp);
        free(tmp);
        putenv(av);
    }

    /* open the rte framework */
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_rte_base_framework, 0))) {
        error = "ompi_rte_base_open() failed";
        goto error;
    }
    /* no select is required as this is a static framework */

    /* Setup RTE */
    if (OMPI_SUCCESS != (ret = ompi_rte_init(NULL, NULL))) {
        error = "ompi_mpi_init: ompi_rte_init failed";
        goto error;
    }
    ompi_rte_initialized = true;

    /* check for timing request - get stop time and report elapsed time if so */
    OPAL_TIMING_MNEXT((&tm,"time from completion of rte_init to modex"));

#if OPAL_HAVE_HWLOC
    /* if hwloc is available but didn't get setup for some
     * reason, do so now
     */
    if (NULL == opal_hwloc_topology) {
        if (OPAL_SUCCESS != (ret = opal_hwloc_base_get_topology())) {
            error = "Topology init";
            goto error;
        }
    }
#endif

    /* Register the default errhandler callback - RTE will ignore if it
     * doesn't support this capability
     */
    ompi_rte_register_errhandler(ompi_errhandler_runtime_callback,
                                 OMPI_RTE_ERRHANDLER_LAST);

    /* Figure out the final MPI thread levels.  If we were not
       compiled for support for MPI threads, then don't allow
       MPI_THREAD_MULTIPLE.  Set this stuff up here early in the
       process so that other components can make decisions based on
       this value. */

    ompi_mpi_thread_level(requested, provided);

    /* determine the bitflag belonging to the threadlevel_support provided */
    memset ( &threadlevel_bf, 0, sizeof(uint8_t));
    OMPI_THREADLEVEL_SET_BITFLAG ( ompi_mpi_thread_provided, threadlevel_bf );

#if OMPI_ENABLE_THREAD_MULTIPLE
    /* add this bitflag to the modex */
    OPAL_MODEX_SEND_STRING(ret, PMIX_SYNC_REQD, PMIX_GLOBAL,
                           "MPI_THREAD_LEVEL", &threadlevel_bf, sizeof(uint8_t));
    if (OPAL_SUCCESS != ret) {
        error = "ompi_mpi_init: modex send thread level";
        goto error;
    }
#endif

    /* If thread support was enabled, then setup OPAL to allow for
       them. */
    if ((OPAL_ENABLE_PROGRESS_THREADS == 1) ||
        (*provided != MPI_THREAD_SINGLE)) {
        opal_set_using_threads(true);
    }

    /* initialize datatypes. This step should be done early as it will
     * create the local convertor and local arch used in the proc
     * init.
     */
    if (OMPI_SUCCESS != (ret = ompi_datatype_init())) {
        error = "ompi_datatype_init() failed";
        goto error;
    }

    /* Initialize OMPI procs */
    if (OMPI_SUCCESS != (ret = ompi_proc_init())) {
        error = "mca_proc_init() failed";
        goto error;
    }

    /* Initialize the op framework. This has to be done *after*
       ddt_init, but befor mca_coll_base_open, since some collective
       modules (e.g., the hierarchical coll component) may need ops in
       their query function. */
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_op_base_framework, 0))) {
        error = "ompi_op_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS !=
        (ret = ompi_op_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
                                           ompi_mpi_thread_multiple))) {
        error = "ompi_op_base_find_available() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = ompi_op_init())) {
        error = "ompi_op_init() failed";
        goto error;
    }

    /* Open up MPI-related MCA components */

    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&opal_allocator_base_framework, 0))) {
        error = "mca_allocator_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&opal_rcache_base_framework, 0))) {
        error = "mca_rcache_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&opal_mpool_base_framework, 0))) {
        error = "mca_mpool_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_bml_base_framework, 0))) {
        error = "mca_bml_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_pml_base_framework, 0))) {
        error = "mca_pml_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_coll_base_framework, 0))) {
        error = "mca_coll_base_open() failed";
        goto error;
    }

    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_osc_base_framework, 0))) {
        error = "ompi_osc_base_open() failed";
        goto error;
    }

#if OPAL_ENABLE_FT_CR == 1
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_crcp_base_framework, 0))) {
        error = "ompi_crcp_base_open() failed";
        goto error;
    }
#endif

    /* In order to reduce the common case for MPI apps (where they
       don't use MPI-2 IO or MPI-1 topology functions), the io and
       topo frameworks are initialized lazily, at the first use of
       relevant functions (e.g., MPI_FILE_*, MPI_CART_*, MPI_GRAPH_*),
       so they are not opened here. */

    /* Select which MPI components to use */

    if (OMPI_SUCCESS !=
        (ret = mca_mpool_base_init(OPAL_ENABLE_PROGRESS_THREADS,
                                   ompi_mpi_thread_multiple))) {
        error = "mca_mpool_base_init() failed";
        goto error;
    }

    if (OMPI_SUCCESS !=
        (ret = mca_pml_base_select(OPAL_ENABLE_PROGRESS_THREADS,
                                   ompi_mpi_thread_multiple))) {
        error = "mca_pml_base_select() failed";
        goto error;
    }

    /* check for timing request - get stop time and report elapsed time if so */
    OPAL_TIMING_MNEXT((&tm,"time to execute modex"));

    /* exchange connection info - this function may also act as a barrier
     * if data exchange is required. The modex occurs solely across procs
     * in our job, so no proc array is passed. If a barrier is required,
     * the "fence" function will perform it internally
     */
    OPAL_FENCE(NULL, 0, NULL, NULL);

    OPAL_TIMING_MNEXT((&tm,"time from modex to first barrier"));

    /* select buffered send allocator component to be used */
    if( OMPI_SUCCESS !=
	(ret = mca_pml_base_bsend_init(ompi_mpi_thread_multiple))) {
        error = "mca_pml_base_bsend_init() failed";
        goto error;
    }

    if (OMPI_SUCCESS !=
        (ret = mca_coll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
                                            ompi_mpi_thread_multiple))) {
        error = "mca_coll_base_find_available() failed";
        goto error;
    }

    if (OMPI_SUCCESS !=
        (ret = ompi_osc_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
                                            ompi_mpi_thread_multiple))) {
        error = "ompi_osc_base_find_available() failed";
        goto error;
    }

#if OPAL_ENABLE_FT_CR == 1
    if (OMPI_SUCCESS != (ret = ompi_crcp_base_select() ) ) {
        error = "ompi_crcp_base_select() failed";
        goto error;
    }
#endif

    /* io and topo components are not selected here -- see comment
       above about the io and topo frameworks being loaded lazily */

    /* Initialize each MPI handle subsystem */
    /* initialize requests */
    if (OMPI_SUCCESS != (ret = ompi_request_init())) {
        error = "ompi_request_init() failed";
        goto error;
    }

    if (OMPI_SUCCESS != (ret = ompi_message_init())) {
        error = "ompi_message_init() failed";
        goto error;
    }

    /* initialize info */
    if (OMPI_SUCCESS != (ret = ompi_info_init())) {
        error = "ompi_info_init() failed";
        goto error;
    }

    /* initialize error handlers */
    if (OMPI_SUCCESS != (ret = ompi_errhandler_init())) {
        error = "ompi_errhandler_init() failed";
        goto error;
    }

    /* initialize error codes */
    if (OMPI_SUCCESS != (ret = ompi_mpi_errcode_init())) {
        error = "ompi_mpi_errcode_init() failed";
        goto error;
    }

    /* initialize internal error codes */
    if (OMPI_SUCCESS != (ret = ompi_errcode_intern_init())) {
        error = "ompi_errcode_intern_init() failed";
        goto error;
    }

    /* initialize groups  */
    if (OMPI_SUCCESS != (ret = ompi_group_init())) {
        error = "ompi_group_init() failed";
        goto error;
    }

    /* initialize communicators */
    if (OMPI_SUCCESS != (ret = ompi_comm_init())) {
        error = "ompi_comm_init() failed";
        goto error;
    }

    /* initialize file handles */
    if (OMPI_SUCCESS != (ret = ompi_file_init())) {
        error = "ompi_file_init() failed";
        goto error;
    }

    /* initialize windows */
    if (OMPI_SUCCESS != (ret = ompi_win_init())) {
        error = "ompi_win_init() failed";
        goto error;
    }

    /* initialize attribute meta-data structure for comm/win/dtype */
    if (OMPI_SUCCESS != (ret = ompi_attr_init())) {
        error = "ompi_attr_init() failed";
        goto error;
    }

    /* identify the architectures of remote procs and setup
     * their datatype convertors, if required
     */
    if (OMPI_SUCCESS != (ret = ompi_proc_complete_init())) {
        error = "ompi_proc_complete_init failed";
        goto error;
    }

    /* start PML/BTL's */
    ret = MCA_PML_CALL(enable(true));
    if( OMPI_SUCCESS != ret ) {
        error = "PML control failed";
        goto error;
    }

    /* add all ompi_proc_t's to PML */
    if (NULL == (procs = ompi_proc_world(&nprocs))) {
        error = "ompi_proc_world() failed";
        goto error;
    }
    ret = MCA_PML_CALL(add_procs(procs, nprocs));
    free(procs);
    /* If we got "unreachable", then print a specific error message.
       Otherwise, if we got some other failure, fall through to print
       a generic message. */
    if (OMPI_ERR_UNREACH == ret) {
        opal_show_help("help-mpi-runtime.txt",
                       "mpi_init:startup:pml-add-procs-fail", true);
        error = NULL;
        goto error;
    } else if (OMPI_SUCCESS != ret) {
        error = "PML add procs failed";
        goto error;
    }

    MCA_PML_CALL(add_comm(&ompi_mpi_comm_world.comm));
    MCA_PML_CALL(add_comm(&ompi_mpi_comm_self.comm));

    /*
     * Dump all MCA parameters if requested
     */
    if (ompi_mpi_show_mca_params) {
        ompi_show_all_mca_params(ompi_mpi_comm_world.comm.c_my_rank,
                                 nprocs,
                                 ompi_process_info.nodename);
    }

    /* Do we need to wait for a debugger? */
    ompi_rte_wait_for_debugger();

    /* Next timing measurement */
    OPAL_TIMING_MNEXT((&tm,"time to execute barrier"));

    /* wait for everyone to reach this point - this is a hard
     * barrier requirement at this time, though we hope to relax
     * it at a later point */
    opal_pmix.fence(NULL, 0);

    /* check for timing request - get stop time and report elapsed
       time if so, then start the clock again */
    OPAL_TIMING_MNEXT((&tm,"time from barrier to complete mpi_init"));

#if OPAL_ENABLE_PROGRESS_THREADS == 0
    /* Start setting up the event engine for MPI operations.  Don't
       block in the event library, so that communications don't take
       forever between procs in the dynamic code.  This will increase
       CPU utilization for the remainder of MPI_INIT when we are
       blocking on RTE-level events, but may greatly reduce non-TCP
       latency. */
    opal_progress_set_event_flag(OPAL_EVLOOP_NONBLOCK);
#endif

    /* wire up the mpi interface, if requested.  Do this after the
       non-block switch for non-TCP performance.  Do before the
       polling change as anyone with a complex wire-up is going to be
       using the oob. */
    if (OMPI_SUCCESS != (ret = ompi_init_preconnect_mpi())) {
        error = "ompi_mpi_do_preconnect_all() failed";
        goto error;
    }

    /* Setup the publish/subscribe (PUBSUB) framework */
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_pubsub_base_framework, 0))) {
        error = "mca_pubsub_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = ompi_pubsub_base_select())) {
        error = "ompi_pubsub_base_select() failed";
        goto error;
    }

    /* Setup the dynamic process management (DPM) framework */
    if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_dpm_base_framework, 0))) {
        error = "ompi_dpm_base_open() failed";
        goto error;
    }
    if (OMPI_SUCCESS != (ret = ompi_dpm_base_select())) {
        error = "ompi_dpm_base_select() failed";
        goto error;
    }

    /* Determine the overall threadlevel support of all processes
       in MPI_COMM_WORLD. This has to be done before calling
       coll_base_comm_select, since some of the collective components
       e.g. hierarch, might create subcommunicators. The threadlevel
       requested by all processes is required in order to know
       which cid allocation algorithm can be used. */
    if ( OMPI_SUCCESS !=
	 ( ret = ompi_comm_cid_init ())) {
	error = "ompi_mpi_init: ompi_comm_cid_init failed";
	goto error;
    }

    /* Init coll for the comms. This has to be after dpm_base_select,
       (since dpm.mark_dyncomm is not set in the communicator creation
       function else), but before dpm.dyncom_init, since this function
       might require collective for the CID allocation. */
    if (OMPI_SUCCESS !=
        (ret = mca_coll_base_comm_select(MPI_COMM_WORLD))) {
        error = "mca_coll_base_comm_select(MPI_COMM_WORLD) failed";
        goto error;
    }

    if (OMPI_SUCCESS !=
        (ret = mca_coll_base_comm_select(MPI_COMM_SELF))) {
        error = "mca_coll_base_comm_select(MPI_COMM_SELF) failed";
        goto error;
    }

    /* Check whether we have been spawned or not.  We introduce that
       at the very end, since we need collectives, datatypes, ptls
       etc. up and running here.... */
    if (OMPI_SUCCESS != (ret = ompi_dpm.dyn_init())) {
        error = "ompi_comm_dyn_init() failed";
        goto error;
    }

    /*
     * Startup the Checkpoint/Restart Mech.
     * Note: Always do this so tools don't hang when
     * in a non-checkpointable build
     */
    if (OMPI_SUCCESS != (ret = ompi_cr_init())) {
        error = "ompi_cr_init";
        goto error;
    }

    /* Undo OPAL calling opal_progress_event_users_increment() during
       opal_init, to get better latency when not using TCP.  Do
       this *after* dyn_init, as dyn init uses lots of RTE
       communication and we don't want to hinder the performance of
       that code. */
    opal_progress_event_users_decrement();

    /* see if yield_when_idle was specified - if so, use it */
    opal_progress_set_yield_when_idle(ompi_mpi_yield_when_idle);

    /* negative value means use default - just don't do anything */
    if (ompi_mpi_event_tick_rate >= 0) {
        opal_progress_set_event_poll_rate(ompi_mpi_event_tick_rate);
    }

    /* At this point, we are fully configured and in MPI mode.  Any
       communication calls here will work exactly like they would in
       the user's code.  Setup the connections between procs and warm
       them up with simple sends, if requested */

    if (OMPI_SUCCESS != (ret = ompi_mpiext_init())) {
        error = "ompi_mpiext_init";
        goto error;
    }

    /* Fall through */
 error:
    if (ret != OMPI_SUCCESS) {
        /* Only print a message if one was not already printed */
        if (NULL != error) {
            const char *err_msg = opal_strerror(ret);
            opal_show_help("help-mpi-runtime.txt",
                           "mpi_init:startup:internal-failure", true,
                           "MPI_INIT", "MPI_INIT", error, err_msg, ret);
        }
        return ret;
    }

    /* Initialize the registered datarep list to be empty */
    OBJ_CONSTRUCT(&ompi_registered_datareps, opal_list_t);

    /* Initialize the arrays used to store the F90 types returned by the
     *  MPI_Type_create_f90_XXX functions.
     */
    OBJ_CONSTRUCT( &ompi_mpi_f90_integer_hashtable, opal_hash_table_t);
    opal_hash_table_init(&ompi_mpi_f90_integer_hashtable, 16 /* why not? */);

    OBJ_CONSTRUCT( &ompi_mpi_f90_real_hashtable, opal_hash_table_t);
    opal_hash_table_init(&ompi_mpi_f90_real_hashtable, FLT_MAX_10_EXP);

    OBJ_CONSTRUCT( &ompi_mpi_f90_complex_hashtable, opal_hash_table_t);
    opal_hash_table_init(&ompi_mpi_f90_complex_hashtable, FLT_MAX_10_EXP);

    /* All done.  Wasn't that simple? */

    ompi_mpi_initialized = true;

    /* Finish last measurement, output results
     * and clear timing structure */
    OPAL_TIMING_MSTOP(&tm);
    OPAL_TIMING_DELTAS(ompi_enable_timing, &tm);
    OPAL_TIMING_REPORT(ompi_enable_timing_ext, &tm);
    OPAL_TIMING_RELEASE(&tm);

    return MPI_SUCCESS;
}
コード例 #22
0
ファイル: Cpresets.cpp プロジェクト: JERUKA9/ffdshow-tryouts
void TpresetsPage::autopreset2dlg(void)
{
    enable(getCheck(IDC_CHB_AUTOPRESET),IDC_CHB_AUTOPRESET_FILEFIRST);
}
コード例 #23
0
StepperMotor::StepperMotor(Pin &step, Pin &dir, Pin &en) : step_pin(step), dir_pin(dir), en_pin(en)
{
    init();
    enable(false);
    set_high_on_debug(en.port_number, en.pin);
}
コード例 #24
0
ファイル: initialize.c プロジェクト: Str8AWay/os
/**
 * Intializes the system and becomes the null process.
 * This is where the system begins after the C environment has been 
 * established.  Interrupts are initially DISABLED, and must eventually 
 * be enabled explicitly.  This routine turns itself into the null process 
 * after initialization.  Because the null process must always remain ready 
 * to run, it cannot execute code that might cause it to be suspended, wait 
 * for a semaphore, or put to sleep, or exit.  In particular, it must not 
 * do I/O unless it uses kprintf for synchronous output.
 */
int nulluser()
{
	kprintf(VERSION);  kprintf("\r\n\r\n");
	
	platforminit();

#ifdef DETAIL
	/* Output detected platform. */
	kprintf("Processor identification: 0x%08X\r\n", cpuid);
	kprintf("Detected platform as: %s\r\n\r\n",platform.name);
#endif

	sysinit();

	/* Output XINU memory layout */
	kprintf("%10d bytes physical memory.\r\n", 
		(ulong) platform.maxaddr & 0x7FFFFFFF );
#ifdef DETAIL
	kprintf("           [0x%08X to 0x%08X]\r\n",
		(ulong) KSEG0_BASE, (ulong) (platform.maxaddr - 1));
#endif 
	kprintf("%10d bytes reserved system area.\r\n",
		(ulong) _start - KSEG0_BASE);
#ifdef DETAIL
	kprintf("           [0x%08X to 0x%08X]\r\n",
		(ulong) KSEG0_BASE, (ulong) _start - 1);
#endif 

	kprintf("%10d bytes XINU code.\r\n",
		(ulong) &end - (ulong) _start);
#ifdef DETAIL
	kprintf("           [0x%08X to 0x%08X]\r\n",
		(ulong) _start, (ulong) &end - 1);
#endif 

	kprintf("%10d bytes stack space.\r\n",
		(ulong) minheap - (ulong) &end);
#ifdef DETAIL
	kprintf("           [0x%08X to 0x%08X]\r\n",
		(ulong) &end, (ulong) minheap - 1);
#endif 

	kprintf("%10d bytes heap space.\r\n",
		(ulong) platform.maxaddr - (ulong) minheap);
#ifdef DETAIL
	kprintf("           [0x%08X to 0x%08X]\r\n\r\n",
		(ulong) minheap, (ulong) platform.maxaddr - 1);
#endif 

	/* TODO: This line won't compile properly until you have added
	 *       a priority parameter to the create() function.
	 */
	ready(create((void *)main, INITSTK, 1, "MAIN", 2, 0, NULL), 0);

	/* enable interrupts here */
	enable();

	while(1) 
	{
		if(nonempty(readylist))
			resched();
		/* If there are no processes left in the system, completed. */
		if (numproc <= 1)
		{
			kprintf("\r\n\r\nAll user processes have completed.\r\n\r\n");
			while (1)
				;
		}
	}
}
コード例 #25
0
void InspectorResourceAgent::enable(ErrorString*)
{
    enable();
}
コード例 #26
0
void k9PlaybackOptions::clear() {
    Ui_playbackOptionsw.lbSequence->clear();
    enable(false);
}
コード例 #27
0
ファイル: control.hpp プロジェクト: myun2/roast_ex_directx
			void disable(){ enable(false); }
コード例 #28
0
bool ExtManager::enable(const string& name, bool flag /* =true */)
{
    return enable(name.c_str(), flag);
}
コード例 #29
0
ProximitySensor::~ProximitySensor() {
    if (mEnabled) {
        enable(0, 0);
    }
}
コード例 #30
0
ファイル: rui.c プロジェクト: Maxsl/r-source
static void menuact(control m)
{
    if (consolegetlazy(RConsole)) check(mlazy); else uncheck(mlazy);

    /* display needs pager set */
    if (R_is_running) enable(mdisplay); else disable(mdisplay);

    if (ConsoleAcceptCmd) {
	enable(msource);
	enable(mload);
	enable(msave);
	enable(mls);
	enable(mrm);
	enable(msearch);

    } else {
	disable(msource);
	disable(mload);
	disable(msave);
	disable(mls);
	disable(mrm);
	disable(msearch);
    }

    if (consolecancopy(RConsole)) {
	enable(mcopy);
	enable(mcopypaste);
    } else {
	disable(mcopy);
	disable(mcopypaste);
    }

    if (consolecanpaste(RConsole)) {
	enable(mpaste);
	enable(mpastecmds);
    }
    else {
	disable(mpaste);
	disable(mpastecmds);
    }

    helpmenuact(hmenu);
    pkgmenuact(pmenu);

    draw(RMenuBar);
}