コード例 #1
0
ファイル: binfmt_misc.cpp プロジェクト: earthGavinLee/darling
void Darling::binfmtDeregister()
{
    checkRoot();

    deregister("Mach-O Universal");

    if (sizeof(void*) == 8)
        deregister("Mach-O 64bit");
    else
        deregister("Mach-O 32bit");
}
コード例 #2
0
static int __dereg_segment(map_segment_t *s)
{
    int rc = OSHMEM_SUCCESS;
    int j;
    int nprocs, my_pe;

    nprocs = oshmem_num_procs();
    my_pe = oshmem_my_proc_id();

    MCA_SPML_CALL(deregister(s->mkeys));

    if (s->mkeys_cache) {
        for (j = 0; j < nprocs; j++) {
            if (j == my_pe)
                continue;
            if (s->mkeys_cache[j]) {
                free(s->mkeys_cache[j]);
                s->mkeys_cache[j] = NULL;
            }
        }
        free(s->mkeys_cache);
        s->mkeys_cache = NULL;
    }

    s->is_active = 0;

    return rc;
}
コード例 #3
0
int main(int argc, char** argv)
{
    int i = 0;
    int j = 0;
    struct timeval t0;
    struct timeval tcur;
    struct timeval wakeup;
    int wakeup_time = 0;
    int period, computation, regi;
    period = 0;
    computation = 0;
    regi = 0;

    //spawnInstances(2);

    fp = fopen("/proc/mp2/status", "w+");
    if(fp == NULL) {
        printf("Could not open /proc/mp2/status\n");
        return -1;
    }

    printf("I am: %d\n", getpid());

    period = atoi(argv[1]);
    computation = atoi(argv[2]);
    printf("period: %d, comp: %d\n", period, computation);
    
    regi = reg(period, computation);
    printf("Reg: %d\n", regi);
    fflush(stdout);
    if(!regi) {
        fprintf(stderr, "Could not register process!\n");
        fflush(stderr);
        fclose(fp);
        return 1;
    }
    printf("p/1k: %d\n", (period/1000));
    gettimeofday(&t0, NULL);
    yield();

    for(i = 0 ; i < 30 ; ++i) {
        printf("i: %d\n", i);
        wakeup_time = t0.tv_sec + ((i+1) * (period / 1000));
        wakeup.tv_sec = wakeup_time;
        printf("Wakeup time (%d): %d\n", getpid(), wakeup_time);
        gettimeofday(&tcur, NULL);
        while(wakeup.tv_sec != tcur.tv_sec) {
            factorial(100000);
            gettimeofday(&tcur, NULL);
        }
        if (i < 30)
            yield();
    }
  
    deregister();

    fclose(fp);

    return 0;
}
コード例 #4
0
ファイル: example.c プロジェクト: MrLynx93/lynx-lwm2m
int main(int argc, char *argv[]) {
    char *client_id = argc > 1 ? argv[1] : "local1";

    lwm2m_context *context = lwm2m_create_context();
    context->has_smartcard = false;
    context->objects = create_example_objects();
    context->factory_bootstrap_callback = perform_factory_bootstrap;
    context->smartcard_bootstrap_callback = NULL;
    context->client_id = client_id;
    context->tls = 0;

//    context->broker_address = "tcp://ec2-52-212-253-117.eu-west-1.compute.amazonaws.com:1883";
    context->broker_address = "34.250.196.139:1883";
    context->endpoint_client_name = client_id;

    lwm2m_start_client(context);

    getchar();
    printf("Stopping...\n");
    // Deregister from all servers
    for (list_elem *elem = context->servers->first; elem != NULL; elem = elem->next) {
        lwm2m_server *server = elem->value;
        deregister(server);
    }
    sleep(2);
    stop_mqtt(context);
    stop_scheduler(context->scheduler);
    return 0;
}
コード例 #5
0
ファイル: DrmaManager.cpp プロジェクト: vinicius/mag
  //-----------------------------------------------------------------------
  void DrmaManager::commitDeregistrations(){
    //FIXME: Acho que tenho de deregistrar de tras pra frente
    pthread_mutex_lock(&pendingDeregistrationsLock);

      vector<Deregistration>::iterator it = pendingDeregistrations.begin();
      vector<Deregistration> temp;
      for ( ;it != pendingDeregistrations.end(); it++)
        if((*it).superstep() == baseProcess_->superstep())
          deregister(*it);
        else
          temp.push_back(*it);
      pendingDeregistrations.swap(temp);

    pthread_mutex_unlock(&pendingDeregistrationsLock);

  }
コード例 #6
0
bool TextClientManager::processRegisterCommand(const std::string &command,
    const Poco::Net::SocketAddress &address) {
    char buf[16] = { 0 };
    if (sscanf(command.c_str(), "deregister %s", buf) != 1) {
        return false;
    }
    buf[sizeof(buf)-1] = 0;

    if (strcmp("all", buf) == 0) {
        deregisterDefault();
    }
    else {
        deregister(atoi(buf));
    }
    return true;
}
コード例 #7
0
void PpuDebugComponent::SetPpu(PPU* ppu)
{
	// Clear previous listener interfaces
	for (auto &deregister : listener_deregister_functions_) { deregister(); }
	listener_deregister_functions_.clear();

	ppu_ = ppu;

	tileset_renderer_.SetPpu(ppu);
	background_renderer_.SetPpu(ppu);

	if (ppu != nullptr)
	{
		// Set listener interfaces
		listener_deregister_functions_.emplace_back(ppu->AddNewFrameListener([this]() { this->Update(); }));
	}
}
コード例 #8
0
int main()
{

    struct timeval t1, t2;
    printf("Input a number representing the number of timers for factorial: ");
    scanf("%d",&ROUND);


    printf("Input a number representing the rate of period over processing: ");
    scanf("%d",&PERIOD_PRO_RATIO);

    printf("Input a number representing the number of repeating jobs: ");
    scanf("%d",&JOB_NUM);

    // estimate the job time
    int comp_time = get_job_time();
    int period = PERIOD_PRO_RATIO * comp_time;

    printf("cal job time: %d ms \n", comp_time);

    // register in the module

    int pid = register_proc(period, comp_time);

    printf("computation time: %d ms, period: %d ms \n", comp_time,period);

    // verify the process was admitted
    if (!verify(pid))
    {
        printf("process %d was not admitted!\n", pid);
        exit(1);
    }

    yield(pid);


    // real-time loop
    int i;
    for (i=0; i<JOB_NUM; i++){
        system("cat /proc/mp2/status");

        gettimeofday(&t1,NULL);
        printf("Start Time of this job with ID %d : %d sec \n",pid,t1.tv_sec);

        do_job();

        gettimeofday(&t2,NULL);
        printf("End Time of this job with ID %d : %d sec \n",pid,t2.tv_sec);

        yield(pid);

    }

    deregister(pid);

    // read the list of processes
    //system("cat /proc/mp2/status");
    printf("Test application ends.\n");

    return 0;
}