예제 #1
0
int
main()
{
	// Basic migration test
	migrate(1);
	migrate(2);
	migrate(1);
	migrate(2);

	printf("testmigr done\n");
	return 0;
}
void __spm_get(void *Ary, long Start, long End, long Reuse) {
	SPMR_DEBUG(std::cout << "Runtime: get page for: " << (long unsigned)Ary
		<< ", " << Start << ", " << End << ", "
		<< Reuse << "\n");

	long PageStart = ((long)Ary + Start)/PAGE_SIZE;
	long PageEnd   = ((long)Ary + End)/PAGE_SIZE;


	if ( (double)(End-Start) > __spm_CacheConstant*__spm_cache_size && (double)Reuse/(End-Start > 0 ? End-Start : 100000) > __spm_ReuseConstant ) { //heuristic

/*
		SPMR_DEBUG(std::cout << "Runtime: get pages: " << PageStart << ", "
			<< PageEnd << "\n");

		pid_t Idx = syscall(SYS_gettid);

		SPMPILock.lock();
		auto It = SPMPI.insert(PageStart, PageEnd, Idx);
		
		if (It == SPMPI.end()) {
			SPMPILock.unlock();
			return;
		}
		SPMPILock.unlock();

		SPMR_DEBUG(std::cout << "Runtime: thread #" << Idx
			<< " now holds pages (possibly amongst others): "
			<< It->first.Start << " to " << It->first.End << "\n");
*/
		return (void) migrate(PageStart, PageEnd);

	}//heuristic
}
예제 #3
0
파일: mergesort.c 프로젝트: DBarthe/Sorts
void mergesort(void **tab, size_t size, CmpFunction cmpFunction, Order order)
{
  void **newTab;
  void **tmpTab;
  void **srcTab;
  void **dstTab;
  size_t n;

  if ((newTab = dupTab(tab, size)) == NULL)
    return ;

  srcTab = tab;
  dstTab = newTab;
  for (n = 1; n < size; n *= 2)
    {
      merge(srcTab, dstTab, n, size, cmpFunction, order);
      tmpTab = srcTab;
      srcTab = dstTab;
      dstTab = tmpTab;
    }
  if (dstTab == tab)
    migrate(srcTab, dstTab, size);

  free(newTab);

#ifdef INFOS
  printf("%lu elements sorted in %lu comparisons with mergesort\n",
	 size, compareCounter);
#endif
}
예제 #4
0
파일: main.cpp 프로젝트: KDE/kleopatra
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
    KCrash::initialize();
    Kdelibs4ConfigMigrator migrate(QStringLiteral("kwatchgnupg"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("kwatchgnupgrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("kwatchgnupgui.rc"));
    migrate.migrate();

    KLocalizedString::setApplicationDomain("kwatchgnupg");
    AboutData aboutData;

    KAboutData::setApplicationData(aboutData);
    QCommandLineParser parser;
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);

    KUniqueService service;

    KWatchGnuPGMainWindow *mMainWin = new KWatchGnuPGMainWindow();
    mMainWin->show();
    return app.exec();
}
예제 #5
0
파일: migrate.c 프로젝트: ryo/netbsd-src
static int
cmd_migrate(gpt_t gpt, int argc, char *argv[])
{
	int ch;
	int force = 0;
	int slice = 0;
	int active = 0;
	u_int parts = 128;

	/* Get the migrate options */
	while ((ch = getopt(argc, argv, "Afp:s")) != -1) {
		switch(ch) {
		case 'A':
			active = 1;
			break;
		case 'f':
			force = 1;
			break;
		case 'p':
			if (gpt_uint_get(gpt, &parts) == -1)
				return usage();
			break;
		case 's':
			slice = 1;
			break;
		default:
			return usage();
		}
	}

	if (argc != optind)
		return usage();

	return migrate(gpt, parts, force, slice, active);
}
예제 #6
0
static void test_baddest(void)
{
    QTestState *from, *to;
    QDict *rsp, *rsp_return;
    const char *status;
    bool failed;

    test_migrate_start(&from, &to, "tcp:0:0", true);
    migrate(from, "tcp:0:0");
    do {
        rsp = wait_command(from, "{ 'execute': 'query-migrate' }");
        rsp_return = qdict_get_qdict(rsp, "return");

        status = qdict_get_str(rsp_return, "status");

        g_assert(!strcmp(status, "setup") || !(strcmp(status, "failed")));
        failed = !strcmp(status, "failed");
        qobject_unref(rsp);
    } while (!failed);

    /* Is the machine currently running? */
    rsp = wait_command(from, "{ 'execute': 'query-status' }");
    g_assert(qdict_haskey(rsp, "return"));
    rsp_return = qdict_get_qdict(rsp, "return");
    g_assert(qdict_haskey(rsp_return, "running"));
    g_assert(qdict_get_bool(rsp_return, "running"));
    qobject_unref(rsp);

    test_migrate_end(from, to, false);
}
예제 #7
0
파일: main.cpp 프로젝트: KDE/krdc
int main(int argc, char **argv)
{
    KLocalizedString::setApplicationDomain("krdc");
    const QString appName = QStringLiteral("krdc");
    QApplication app(argc, argv);
    QTime startupTimer;
    startupTimer.start();

    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    Kdelibs4ConfigMigrator migrate(appName);
    migrate.setConfigFiles(QStringList() << QStringLiteral("krdcrc"));
    if (migrate.migrate()) {
        Kdelibs4Migration dataMigrator;
        const QString sourceBasePath = dataMigrator.saveLocation("data", QStringLiteral("krdc"));
        const QString targetBasePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/krdc/");
        QString targetFilePath;
        QDir sourceDir(sourceBasePath);
        QDir targetDir(targetBasePath);
        if (sourceDir.exists()) {
            if (!targetDir.exists()) {
                QDir().mkpath(targetBasePath);
            }
            QStringList fileNames = sourceDir.entryList(QDir::Files |
                                    QDir::NoDotAndDotDot | QDir::NoSymLinks);
            foreach (const QString &fileName, fileNames) {
                targetFilePath = targetBasePath + fileName;
                if (!QFile::exists(targetFilePath)) {
                    QFile::copy(sourceBasePath + fileName, targetFilePath);
                }
            }
        }
		void migrate(virtual_machine_pointer ptr_vm,
					 physical_machine_type& pm,
					 ForwardIterT first_share,
					 ForwardIterT last_share)
	{
		migrate(ptr_vm, pm);
		ptr_vm->resource_shares(first_share, last_share);
	}
예제 #9
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setApplicationVersion("0.9.8");
    App::instance()->settings = new QSettings("Sobhe", "Ketabkhaane");

    // arguments
    if (argc >= 2) {
        QString command = argv[1];

        if (command == "--data") {
            QString folder;
            if (argc == 3)
                folder = argv[2];
            if (folder.isEmpty())
                folder = getAbsoluteAddress("data");

            App::instance()->settings->setValue("DataFolder", folder.replace("\\", "/"));
            exit(0);
        }
    }

    // set default folder
    if (App::instance()->settings->value("DataFolder").toString().isEmpty())
        App::instance()->settings->setValue("DataFolder", getAbsoluteAddress("data"));

    // translation
    QTranslator rTranslator;
    rTranslator.load("application_fa");
    a.installTranslator(& rTranslator);

    QTranslator qTranslator;
    qTranslator.load("qt_fa");
    a.installTranslator(& qTranslator);

    // style
     a.setStyle("fusion");
    QFile qss(":/resources/default.qss");
    qss.open(QFile::ReadOnly);
    a.setStyleSheet(qss.readAll());
    qss.close();

    // db connection
    if (Connector::connectDb().isOpen())
        migrate(a.applicationVersion());

    // init cache db
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "cache");
    db.setDatabaseName(":memory:");
    if (! db.open()) qDebug() << "cache db error : " << db.lastError();

    // execute
    MainWindow w;
    w.show();

    return a.exec();
}
// Output JSON to Serial
void KeyValueStore::output() {
  migrate();
  String json = readJson();
  StaticJsonBuffer<300> jsonBuffer;
  JsonObject& root = jsonBuffer.parseObject(json);
  if (!root.success()) {
    Serial.println("parseObject() failed");
    return;
  }
  root.prettyPrintTo(Serial);
  Serial.println();
}
예제 #11
0
파일: rib.c 프로젝트: ibaned/tetknife
void mesh_balance_rib(mesh* m)
{
  unsigned n;
  point* o;
  rcopy* idx;
  mlabel* plan;
  prepare_rib_input(m, &n, &o, &idx);
  recursive_inertial_bisection(&n, &o, &idx);
  plan = plan_from_rib(m, n, idx);
  my_free(o);
  my_free(idx);
  migrate(m, plan);
  mlabel_free(plan);
}
예제 #12
0
파일: KBruch.cpp 프로젝트: KDE/kbruch
/* the main program */
int main(int argc, char * argv[])
{
    // init random generator
    srand(time(NULL));
    QApplication app(argc, argv);

    KLocalizedString::setApplicationDomain("kbruch");

    Kdelibs4ConfigMigrator migrate(QStringLiteral("kbruch"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("kbruchrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("AppMenuWidgetui.rc") <<  QStringLiteral("FractionRingWidgetui.rc") << QStringLiteral("kbruchui.rc"));
    migrate.migrate();


    /* fill the about data; the common KDE about dialog will show it to the
     * user */
    KAboutData aboutData(QStringLiteral("kbruch"), i18n("KBruch"),
                         QStringLiteral(KBRUCH_VERSION),
                         i18n("Learn calculating with fractions"),
                         KAboutLicense::GPL,
                         i18n("© 2002-2011, Sebastian Stein"));
    aboutData.addAuthor(i18n("Sebastian Stein"), i18n("Current maintainer, original author"), QStringLiteral("*****@*****.**"));
    aboutData.addAuthor(i18n("Paulo Cattai"), i18n("New interface design and usability improvements"), QStringLiteral("*****@*****.**"));
    aboutData.addAuthor(i18n("Danilo Balzaque"), i18n("New interface design and usability improvements"), QStringLiteral("*****@*****.**"));
    aboutData.addAuthor(i18n("Roberto Cunha"), i18n("New interface design and usability improvements"), QStringLiteral("*****@*****.**"));
    aboutData.addAuthor(i18n("Tadeu Araujo"), i18n("New interface design and usability improvements"), QStringLiteral("*****@*****.**"));
    aboutData.addAuthor(i18n("Tiago Porangaba"), i18n("New interface design and usability improvements"), QStringLiteral("*****@*****.**"));
    aboutData.setHomepage(QStringLiteral("http://edu.kde.org/kbruch/"));

    KCrash::initialize();

    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);

    QObject::connect(&app, &QApplication::lastWindowClosed, &app, &QApplication::quit);

    AppMenuWidget * kbruchApp = new AppMenuWidget();
    kbruchApp->show();

    /* lets execute the Qt GUI; it will handle all cmd options which are left */
    return app.exec();
}
예제 #13
0
파일: main.cpp 프로젝트: KDE/kdiamond
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    Kdelibs4ConfigMigrator migrate(QStringLiteral("kdiamond"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("kdiamondrc") << QStringLiteral("kdiamond.notifyrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("kdiamondui.rc"));
    migrate.migrate();

    qsrand(time(0));
    KLocalizedString::setApplicationDomain("kdiamond");
    KAboutData about(QStringLiteral("kdiamond"), i18nc("The application's name", "KDiamond"), QLatin1Literal(version), i18n(description),
                     KAboutLicense::GPL, i18n("(C) 2008-2010 Stefan Majewsky and others"), QStringLiteral("http://games.kde.org/kdiamond"));
    about.addAuthor(i18n("Stefan Majewsky"), i18n("Original author and current maintainer"), QStringLiteral("*****@*****.**"));
    about.addAuthor(i18n("Paul Bunbury"), i18n("Gameplay refinement"), QStringLiteral("*****@*****.**"));
    about.addCredit(i18n("Eugene Trounev"), i18n("Default theme"), QStringLiteral("*****@*****.**"));
    about.addCredit(i18n("Felix Lemke"), i18n("Classic theme"), QStringLiteral("*****@*****.**"));
    about.addCredit(i18n("Jeffrey Kelling"), i18n("Technical consultant"), QStringLiteral("*****@*****.**"));
    QCommandLineParser parser;
    KAboutData::setApplicationData(about);
    KCrash::initialize();
    parser.addVersionOption();
    parser.addHelpOption();
    about.setupCommandLine(&parser);
    parser.process(app);
    about.processCommandLine(&parser);

    app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdiamond")));

    //resource directory for KNewStuff2 (this call causes the directory to be created; its existence is necessary for the downloader)
    QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1String("/themes/");

    Kg::difficulty()->addStandardLevelRange(
        KgDifficultyLevel::VeryEasy,
        KgDifficultyLevel::VeryHard
    );
    KDBusService service;
    // see if we are starting with session management
    if (app.isSessionRestored()) {
        RESTORE(MainWindow);
    } else {
        MainWindow *window = new MainWindow;
        window->show();
    }
    return app.exec();
}
예제 #14
0
int main(int argc, char** argv) {

	//parparser parser(argc, argv);

	//long inititalPosition = parser.get("x").asLong();

	srand(time(0));

	//-----------------------------------------------------------------------------

	MPICHECK(MPI_Init(&argc, &argv));
	//-----------------------------------------------------------------------------

	int commSize = 0;
	int rank = 0;
	MPICHECK(MPI_Comm_size(MPI_COMM_WORLD, &commSize));
	MPICHECK(MPI_Comm_rank(MPI_COMM_WORLD, &rank));

	const int nextProc = rank == commSize - 1 ? 0 : rank + 1;
	const int prevProc = rank == 0 ? commSize - 1 : rank - 1;

	vector<Individ> population(islandSize);
	for (int i = 0; i < islandSize; ++i) {
		population[i].init(problemSize);
	}

	for (int i = 1; i <= iterationsThreshold; ++i) {
		select(population);
		crossoverPopulation(population);
		mutatePopulation(population);

		if (i % migrationFreq == 0) {
			migrate(population, nextProc, prevProc);
		}

		cout << getBestFitness(population, rank, commSize) << "\n";
	}
	
	//-----------------------------------------------------------------------------


	//-----------------------------------------------------------------------------
	MPICHECK(MPI_Finalize());
	return 0;
}
예제 #15
0
static void test_migrate(void)
{
    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
    QTestState *from, *to;

    test_migrate_start(&from, &to, uri, false);

    migrate_set_capability(from, "postcopy-ram", "true");
    migrate_set_capability(to, "postcopy-ram", "true");
    migrate_set_capability(to, "postcopy-blocktime", "true");

    /* We want to pick a speed slow enough that the test completes
     * quickly, but that it doesn't complete precopy even on a slow
     * machine, so also set the downtime.
     */
    migrate_set_parameter(from, "max-bandwidth", "100000000");
    migrate_set_parameter(from, "downtime-limit", "1");

    /* Wait for the first serial output from the source */
    wait_for_serial("src_serial");

    migrate(from, uri);

    wait_for_migration_pass(from);

    migrate_start_postcopy(from);

    if (!got_stop) {
        qtest_qmp_eventwait(from, "STOP");
    }

    qtest_qmp_eventwait(to, "RESUME");

    wait_for_serial("dest_serial");
    wait_for_migration_complete(from);

    if (uffd_feature_thread_id) {
        read_blocktime(to);
    }
    g_free(uri);

    test_migrate_end(from, to, true);
}
예제 #16
0
void
umain(int argc, char **argv) {
	void *addr = (void *)(USTACKTOP - 10*PGSIZE);
	cprintf("starting in umain\n");
	int r = fork();
	if (r < 0) panic("testmigrate: fork: %e\n", r);
	if (r == 0) {
		for (int i = 0; i < 100; i++) {
			sys_yield();
		}
		cprintf("CHILD: going to migrate locally\n");
		cprintf("CHILD: physical pg num: %x\n", PGNUM(vpt[PGNUM(addr)]));
		int *addr_int = (int *)addr;
		addr_int[1] = 55;
		int r = migrate();
		cprintf("[%08x]: Hello from your migrated process!\n", thisenv->env_id);
		cprintf("addr_int[0] = %d, addr_int[1] = %d\n",
				addr_int[0], addr_int[1]);
		return;
	}
	else {
		envid_t envid = (envid_t)r;
		cprintf("XXX LA LA LA: fork good.  new envid %x\n", envid);
		if (sys_page_alloc(0, addr, PTE_U | PTE_P | PTE_W) < 0)
			panic("sys_page_alloc");
		if (sys_page_map(0, addr, envid, addr, PTE_U | PTE_P | PTE_W) < 0)
			panic("sys_page_map");
		cprintf("XXX LA LA LA: mapped a shared page.\n");
		cprintf("XXX LA LA LA: physical pg num: %x\n", PGNUM(vpt[PGNUM(addr)]));
		int *addr_int = (int *)addr;
		addr_int[0] = 60;
		for (int i = 0; i < 6000; i++) {
			sys_yield();
		}
		cprintf("TRYING TO WRITE TO THE PAGE THAT GOT MIGRATED AWAY\n");
		addr_int[2] = 42;
		cprintf("SUCCESSFULLY WROTE TO THE PAGE THAT GOT MIGRATED AWAY\n");
		cprintf("AND THE ANSWER IS: %d\n", addr_int[0]);
		cprintf("AND THE ANSWER IS: %d\n", addr_int[1]);
		cprintf("AND THE ANSWER IS: %d\n", addr_int[2]);
		while (1) sys_yield() ;
	}
}
예제 #17
0
void Population::doGeneration(std::vector<std::tuple<int, int, int>> &points){
	std::vector<std::pair<float, std::shared_ptr<Node>>> newPop;
	for(auto &func : population){
		score(points, func);
	}
	std::sort(population.begin(), population.end());
	if(population[0].first < best.first){
		best = std::make_pair(population[0].first, serializeTree(population[0].second));
	}
	for(int i = 0; i < population.size() - 1; i += 2){
		crossover(population[i].second, population[i + 1].second);
		mutate(population[i].second);
		mutate(population[i + 1].second);
		newPop.push_back(std::make_pair(0.0, population[i].second));
		newPop.push_back(std::make_pair(0.0, population[i + 1].second));
	}
	migrate(newPop);
	population = newPop;
}
예제 #18
0
const char * XAP_UnixApp::getUserPrivateDirectory()
{
	/* return a pointer to a static buffer */
    static char *buf = NULL;

    if (buf == NULL)
    {
		const char * szAbiDir = "abiword";
		const char * szCfgDir = ".config";

		const char * szXDG = getenv("XDG_CONFIG_HOME");
		if (!szXDG || !*szXDG) {
			const char * szHome = getenv("HOME");
			if (!szHome || !*szHome)
				szHome = "./";

			buf = new char[strlen(szHome)+strlen(szCfgDir)+strlen(szAbiDir)+4];

			strcpy(buf, szHome);
			if (buf[strlen(buf)-1] != '/')
				strcat(buf, "/");
			strcat(buf, szCfgDir);
		} else {
			buf = new char[strlen(szXDG)+strlen(szAbiDir)+4];
			strcpy(buf, szXDG);
		}

		strcat(buf, "/");
		strcat(buf, szAbiDir);

#ifdef PATH_MAX
        if (strlen(buf) >= PATH_MAX)
            DELETEPV(buf);
#endif

		// migration / legacy
		migrate("/AbiSuite", szAbiDir, buf); 
    }

	return buf;
}
예제 #19
0
RollbackManager::RollbackManager(const std::string & world_path,
		IGameDef * gamedef_) :
	gamedef(gamedef_)
{
	verbosestream << "RollbackManager::RollbackManager(" << world_path
		<< ")" << std::endl;

	std::string txt_filename = world_path + DIR_DELIM "rollback.txt";
	std::string migrating_flag = txt_filename + ".migrating";
	database_path = world_path + DIR_DELIM "rollback.sqlite";

	bool created = initDatabase();

	if (fs::PathExists(txt_filename) && (created ||
			fs::PathExists(migrating_flag))) {
		std::ofstream of(migrating_flag.c_str());
		of.close();
		migrate(txt_filename);
		fs::DeleteSingleFileOrEmptyDirectory(migrating_flag);
	}
}
예제 #20
0
파일: main.cpp 프로젝트: KDE/kdepim
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
    app.setAttribute(Qt::AA_EnableHighDpiScaling);
    KCrash::initialize();
    Kdelibs4ConfigMigrator migrate(QStringLiteral("headerthemeeditor"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("headerthemeeditorrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("headerthemeeditorui.rc"));
    migrate.migrate();
    KLocalizedString::setApplicationDomain("headerthemeeditor");
    KAboutData aboutData(QStringLiteral("headerthemeeditor"),
                         i18n("Header Theme Editor"),
                         QStringLiteral(GRANTLEEEDITOR_VERSION),
                         i18n("Messageviewer Header Theme Editor"),
                         KAboutLicense::GPL_V2,
                         i18n("Copyright © 2013-2016 headerthemeeditor authors"));
    aboutData.addAuthor(i18n("Laurent Montel"), i18n("Maintainer"), QStringLiteral("*****@*****.**"));
    QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
    aboutData.setOrganizationDomain(QByteArray("kde.org"));
    aboutData.setProductName(QByteArray("headerthemeeditor"));

    KAboutData::setApplicationData(aboutData);

    QCommandLineParser parser;
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);

    parser.process(app);
    aboutData.processCommandLine(&parser);

    KDBusService service;

    ThemeEditorMainWindow *mw = new ThemeEditorMainWindow();
    mw->show();
    const int ret = app.exec();
    return ret;
}
예제 #21
0
void test_migrate() 
{
    const double DIR = 3.925; // roughly 225 degrees to x axis
    const double MOTILITY = 1.0;
   	char_array * id_temp;
   	// to prevent dir being changed in migrate
   	double nonr[1] = {0.2};
	//set_non_random(&nonr[0], 1);
	
	//initialise();
	calcium_level = 0.1;
	
	// add agent at x=zero y=zero heading of the both x and y edges at 0,0
	id_temp = init_char_array();
	add_char(id_temp, '1');
	add_keratinocyte_agent(id_temp, K_TYPE_TA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MOTILITY, DIR, 0);	
	current_xmachine = *p_xmachine;

	migrate();	
	
	// test that we are still on the substrate
	CU_ASSERT(get_x() > 0);
	CU_ASSERT(get_y() > 0);	
} 
예제 #22
0
파일: korgacmain.cpp 프로젝트: KDE/kdepim
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
    app.setAttribute(Qt::AA_EnableHighDpiScaling);
    Kdelibs4ConfigMigrator migrate(QStringLiteral("korgac"));

    migrate.setConfigFiles(QStringList() << QStringLiteral("korgacrc"));
    migrate.migrate();

    KAboutData aboutData(QStringLiteral("korgac"), i18n("KOrganizer Reminder Daemon"),
                         QStringLiteral(KORGANIZER_VERSION), i18n("KOrganizer Reminder Daemon"),
                         KAboutLicense::GPL,
                         i18n("(c) 2003 Cornelius Schumacher"),
                         QString(), QStringLiteral("http://pim.kde.org"));
    aboutData.addAuthor(i18n("Cornelius Schumacher"), i18n("Former Maintainer"),
                        QStringLiteral("*****@*****.**"));
    aboutData.addAuthor(i18n("Reinhold Kainhofer"), i18n("Former Maintainer"),
                        QStringLiteral("*****@*****.**"));
    aboutData.addAuthor(i18n("Allen Winter"), i18n("Janitorial Staff"),
                        QStringLiteral("*****@*****.**"));

    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);

    KDBusService service(KDBusService::Unique);
    KOAlarmClient client;
    //app.disableSessionManagement();

    return app.exec();
}
예제 #23
0
파일: main.cpp 프로젝트: KDE/blinken
int main(int argc, char *argv[])
{
	KLocalizedString::setApplicationDomain("blinken");

	QApplication app(argc, argv);
	KAboutData about("blinken", i18n("Blinken"), "0.4", i18n("A memory enhancement game"), KAboutLicense::GPL, i18n("© 2005-2007 Albert Astals Cid\n© 2005-2007 Danny Allen"));
	about.addAuthor(i18n("Albert Astals Cid"), i18n("Coding"), "*****@*****.**");
	about.addAuthor(i18n("Danny Allen"), i18n("Design, Graphics and Sounds"), "*****@*****.**");
	about.addCredit(i18n("Steve Jordi"), i18n("GPL'ed his 'Steve' font so that we could use it"), "*****@*****.**");

	KAboutData::setApplicationData(about);

	KCrash::initialize();

	Kdelibs4ConfigMigrator migrate(QStringLiteral("blinken"));
	migrate.setConfigFiles(QStringList() << QStringLiteral("blinkenrc"));
	migrate.migrate();


	QCommandLineParser parser;
	about.setupCommandLine(&parser);
	parser.process(app);
	about.processCommandLine(&parser);

	app.setWindowIcon(QIcon::fromTheme(QLatin1String("blinken")));

	QFont f("Steve", 12, QFont::Normal, true);
	// Works with Steve may need some tweaking to work with other fonts
	if (!QFontInfo(f).exactMatch())
	{
		QFontDatabase::addApplicationFont(QStandardPaths::locate(QStandardPaths::DataLocation, "fonts/steve.ttf"));
	}
	KDBusService service;
	new blinken();
	return app.exec();
}
예제 #24
0
bool MigrationEngine::migrate(int to)
{
    return migrate(currentMigration(), to);
}
예제 #25
0
void redis_reshard::run()
{
	if (get_masters_info() == false)
		return;

	show_nodes();
	fflush(stdout);
	char buf[1024];

	int nslots = 0;
	while (true)
	{
		printf("How many slots do you want to move (from 1 to 16384) ? ");
		fflush(stdout);
		int ret = acl_vstream_gets_nonl(ACL_VSTREAM_IN, buf, sizeof(buf));
		if (ret == ACL_VSTREAM_EOF)
			exit(1);
		acl_mystr_trim(buf);
		nslots = atoi(buf);
		if (nslots > 0 && nslots < 16384)
			break;
		printf("invalid value: %d\r\n", ret);
	}

	acl::redis_node* target = NULL;
	while (true)
	{
		printf("What is the receiving node ID? ");
		fflush(stdout);
		int ret = acl_vstream_gets_nonl(ACL_VSTREAM_IN, buf, sizeof(buf));
		if (ret == ACL_VSTREAM_EOF)
			exit(1);

		acl_mystr_trim(buf);
		target = find_node(buf);
		if (target != NULL)
			break;

		printf("...The specified node(%s) is not known or not "
			"a master, please try again.\r\n", buf);
	}
	assert(target != NULL);

	printf("Please input all the source node IDs.\r\n");
	printf("  Type 'all' to use all the nodes as source nodes for the hash slots\r\n");
	printf("  Type 'done' once you entered all the source node IDs.\r\n");

	std::vector<acl::redis_node*> sources;
	while (true)
	{
		printf("Source node #%d: ", (int) sources.size() + 1);
		fflush(stdout);
		int ret = acl_vstream_gets_nonl(ACL_VSTREAM_IN, buf, sizeof(buf));
		if (ret == ACL_VSTREAM_EOF)
			exit(1);

		acl_mystr_trim(buf);
		if (strcasecmp(buf, "done") == 0)
			break;
		if (strcasecmp(buf, "all") == 0)
		{
			copy_all(sources, target->get_id());
			break;
		}

		acl::redis_node* source = find_node(buf);
		if (source == NULL)
		{
			printf("...The source node(%s) is not known\r\n", buf);
			continue;
		}
		if (strcmp(target->get_id(), buf) == 0)
		{
			printf("... It is not possible to use the target node as source node\r\n");
			continue;
		}
		
		sources.push_back(source);
	}
	if (sources.empty())
	{
		printf("*** No source nodes given, operation aborted\r\n");
		exit(1);
	}

	redis_migrate migrate(masters_);
	migrate.move_slots(sources, *target, nslots);
}
예제 #26
0
// The main function
int main(int argc, char* argv[])
{
	int option_index = 0;
	int opt;

	char* dbPath = NULL;
	char* userPIN = NULL;
	char* module = NULL;
	char* slot = NULL;
	char* serial = NULL;
	char* token = NULL;
	char *errMsg = NULL;
	int noPublicKey = 0;

	int result = 0;
	CK_RV rv;

	moduleHandle = NULL;
	p11 = NULL;
	CK_SLOT_ID slotID = 0;

	if (argc == 1)
	{
		usage();
		exit(0);
	}

	while ((opt = getopt_long(argc, argv, "hv", long_options, &option_index)) != -1)
	{
		switch (opt)
		{
			case OPT_DB:
				dbPath = optarg;
				break;
			case OPT_SLOT:
				slot = optarg;
				break;
			case OPT_SERIAL:
				serial = optarg;
				break;
			case OPT_TOKEN:
				token = optarg;
				break;
			case OPT_MODULE:
				module = optarg;
				break;
			case OPT_NO_PUBLIC_KEY:
				noPublicKey = 1;
				break;
			case OPT_PIN:
				userPIN = optarg;
				break;
			case OPT_VERSION:
			case 'v':
				printf("%s\n", PACKAGE_VERSION);
				exit(0);
				break;
			case OPT_HELP:
			case 'h':
			default:
				usage();
				exit(0);
				break;
		}
	}

	// Get a pointer to the function list for PKCS#11 library
	CK_C_GetFunctionList pGetFunctionList = loadLibrary(module, &moduleHandle, &errMsg);
	if (pGetFunctionList == NULL)
	{
		fprintf(stderr, "ERROR: Could not load the library: %s\n", errMsg);
		exit(1);
	}

	// Load the function list
	(*pGetFunctionList)(&p11);

	// Initialize the library
	rv = p11->C_Initialize(NULL_PTR);
	if (rv != CKR_OK)
	{
		fprintf(stderr, "ERROR: Could not initialize the library.\n");
		exit(1);
	}

	// Get the slotID
	result = findSlot(slot, serial, token, slotID);

	if (!result)
	{
		// Migrate the database
		result = migrate(dbPath, slotID, userPIN, noPublicKey);
	}

	// Finalize the library
	p11->C_Finalize(NULL_PTR);
	unloadLibrary(moduleHandle);

	return result;
}
예제 #27
0
bool MigrationEngine::migrate()
{
    return migrate(migrationsCount());
}
예제 #28
0
extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
{
    QApplication app(argc, argv);
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
    app.setWindowIcon(QIcon::fromTheme("system-file-manager"));

    KCrash::initialize();

    Kdelibs4ConfigMigrator migrate(QStringLiteral("dolphin"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("dolphinrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("dolphinpart.rc") << QStringLiteral("dolphinui.rc"));
    migrate.migrate();

    KAboutData aboutData("dolphin", i18n("Dolphin"), QStringLiteral(DOLPHIN_VERSION_STRING),
                         i18nc("@title", "File Manager"),
                         KAboutLicense::GPL,
                         i18nc("@info:credit", "(C) 2006-2014 Peter Penz, Frank Reininghaus, and Emmanuel Pescosta"));
    aboutData.setHomepage("http://dolphin.kde.org");
    aboutData.addAuthor(i18nc("@info:credit", "Emmanuel Pescosta"),
                        i18nc("@info:credit", "Maintainer (since 2014) and developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Frank Reininghaus"),
                        i18nc("@info:credit", "Maintainer (2012-2014) and developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Peter Penz"),
                        i18nc("@info:credit", "Maintainer and developer (2006-2012)"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Sebastian Trüg"),
                        i18nc("@info:credit", "Developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "David Faure"),
                        i18nc("@info:credit", "Developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Aaron J. Seigo"),
                        i18nc("@info:credit", "Developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Rafael Fernández López"),
                        i18nc("@info:credit", "Developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Kevin Ottens"),
                        i18nc("@info:credit", "Developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Holger Freyther"),
                        i18nc("@info:credit", "Developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Max Blazejak"),
                        i18nc("@info:credit", "Developer"),
                        "*****@*****.**");
    aboutData.addAuthor(i18nc("@info:credit", "Michael Austin"),
                        i18nc("@info:credit", "Documentation"),
                        "*****@*****.**");

    KAboutData::setApplicationData(aboutData);

    KDBusService dolphinDBusService;
    DBusInterface interface;

    QCommandLineParser parser;
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);

    // command line options
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("select"), i18nc("@info:shell", "The files and directories passed as arguments "
                                                                                        "will be selected.")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("split"), i18nc("@info:shell", "Dolphin will get started with a split view.")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("daemon"), i18nc("@info:shell", "Start Dolphin Daemon (only required for DBus Interface)")));
    parser.addPositionalArgument(QLatin1String("+[Url]"), i18nc("@info:shell", "Document to open"));

    parser.process(app);
    aboutData.processCommandLine(&parser);

    if (parser.isSet("daemon")) {
        return app.exec();
    }

    const QStringList args = parser.positionalArguments();
    QList<QUrl> urls = Dolphin::validateUris(args);

    if (urls.isEmpty()) {
        // We need at least one URL to open Dolphin
        urls.append(Dolphin::homeUrl());
    }

    const bool splitView = parser.isSet("split") || GeneralSettings::splitView();
    if (splitView && urls.size() < 2) {
        // Split view does only make sense if we have at least 2 URLs
        urls.append(urls.last());
    }

    DolphinMainWindow* mainWindow = new DolphinMainWindow();
    mainWindow->setAttribute(Qt::WA_DeleteOnClose);

    if (parser.isSet("select")) {
        mainWindow->openFiles(urls, splitView);
    } else {
        mainWindow->openDirectories(urls, splitView);
    }

    mainWindow->show();

    if (app.isSessionRestored()) {
        const QString className = KXmlGuiWindow::classNameOfToplevel(1);
        if (className == QLatin1String("DolphinMainWindow")) {
            mainWindow->restore(1);
        } else {
           qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!";
        }
    }

    return app.exec(); // krazy:exclude=crash;
}
예제 #29
0
bool MigrationEngine::undo()
{
    return migrate(0);
}
예제 #30
0
void
SchedulerTimer::timerInterrupt(SoftIntr::IntrType)
{
    // use when as estimate of time unless its cheap to read
    // the clock
    // FIXME:  This usermodeClock trick assumes that interrupts won't be
    //         delivered earlier than expected, an assumption that is
    //         violated when a dispatcher is migrated from one physical
    //         processor to another.  An early interrupt will cause us to
    //         invoke event handlers before their expected times.  To fix
    //         this problem, we should pass the current time up to the
    //         dispatcher when we generate a soft timer interrupt for it.
    SysTime old = when;
    SysTime start = old;
    AutoListHead runList;

    runList.init();
    now = usermodeClock?getClock():when;

    TimerEvent* cur;
    if (unlikely(now < when)) {
	if (when == SysTime(-1)) {
	    now = _TIMER_REQUEST(when, TimerEvent::reset);
	} else {
	    now = _TIMER_REQUEST(when,TimerEvent::absolute);
	}
    }
    while (now > when) {

	cur = anchor;
	// Run the current timer
	anchor = NULL;
	if (cur) {
	    cur->lockedDetach();
//	    tassertWrn(old <= cur->when, "stale event: %lx %lx %lx\n",
//		       uval(old), uval(cur->when), uval(now));
	    runList.prepend(cur);
	}

	cur = (TimerEvent*)immediate.next();
	// Scan immediate timer list, looking for expired timers,
	// first timer to go off next.
	while (cur) {
	    TimerEvent *te = cur;
	    cur = (TimerEvent*)cur->next();
	    tassertMsg(bucketEnd(now)>=te->when,
		       "Bad event on immediate list: %lx %lx %p\n",
		       uval(now), uval(te->when), te);

	    if (te->when <= now) {
		te->lockedDetach();
		tassertWrn(old <= te->when, "stale event3: %lx %lx %lx\n",
			   uval(old), uval(te->when), uval(now));
		runList.prepend(te);
	    } else if (!anchor ||
		       te->when <= anchor->when) {
		anchor = te;
		when = te->when;
	    }
	}

	// Move all events for buckets containing  "start" to "now"
	// to immediate list
	migrate(start, now, runList);


	if (!anchor) {
	    // No "anchor" timer to go off next, look for the next bucket
	    // with timers.

	    // we start in current slot, then increment
	    SysTime nextSlot = bucketStart(now + BUCKET_TICKS);
	    while (timeIndex(old) != timeIndex(nextSlot)
		   && !table[timeIndex(nextSlot)].next()) {
		nextSlot += BUCKET_TICKS;
	    }

	    if (timeIndex(now) == timeIndex(nextSlot)
		&& !table[timeIndex(nextSlot)].next()) {

		when = SysTime(-1);
	    } else {
		when = nextSlot;
	    }
	}

#if 0

	if (when==SysTime(-1)) {
	    SchedulerTimer *st = &DISPATCHER->timer;
	    for (uval i = 0; i<TABLE_SIZE; ++i) {
		TimerEvent *t = (TimerEvent*)st->table[i].next();
		tassertMsg(t==NULL,
			   "Existing event, no timer: %lx %p %p %p %p\n",
			   i,t,st,DISPATCHER,this);
	    }
	}
	{
	    SchedulerTimer *st = &DISPATCHER->timer;
	    for (uval i = 0; i<TABLE_SIZE; ++i) {
		TimerEvent *t = (TimerEvent*)st->table[i].next();
		while (t) {
		    tassertMsg(timeIndex(t->when) != timeIndex(now) ||
			       t->when > bucketEnd(now),
			       "event not in immediate: %p %lx %lx %lx\n",t,
			       uval(now), uval(t->when), uval(when));

		    tassertMsg(t->when > now, "stale event in table %p\n", t);

		    t = (TimerEvent*)t->next();

		}
	    }
	}
#endif
	// adjust timer only if it has changed
	if (when != old) {
	    if (when == SysTime(-1)) {
		now = _TIMER_REQUEST(when, TimerEvent::reset);
	    } else {
		now = _TIMER_REQUEST(when,TimerEvent::absolute);
	    }
	}
    }

    // Run expired timers We do this after all of the processing abov,
    // rather than as we encounter these events because handleEvent()
    // may lead to SchedulerTimer::disabledScheduleEvent, and we don't
    // want that code to run while the timer object's state is in the
    // midst of the computations above -- we want that code to run on
    // a clean slate. Only now can we run these callbacks while
    // ensuring that SchedulerTimer is fully cleaned up.
    cur = (TimerEvent*)runList.next();
    while (cur) {
	TimerEvent *te = (TimerEvent*)cur;
	cur = (TimerEvent*)cur->next();
	te->lockedDetach();
	te->handleEvent();
    }
//    err_printf("next timer: %p %lx\n", DISPATCHER, uval(when));
}