Пример #1
0
rtems_task Init(rtems_task_argument argument)
{
	rtems_status_code sc;

	sc = rtems_shell_init(
		"SHLL",
		RTEMS_MINIMUM_STACK_SIZE * 8,
		1, /* We want it to work */
		"/dev/console",
		false,
		false,
		NULL
	);
	if(sc != RTEMS_SUCCESSFUL)
		printf("Unable to start shell (error code %d)\n", sc);

	/* FIXME:
	 * alarm() should work anyway in gethostbyname().(for TIMEOUT in libcurl)
	 * in the meantime we have a workaround,
	 * make sure the gethostbyname() finished in 15 seconds
	 */
	_res.retry = 2;

	/* FIXME: can this be moved into the initialization table? */
	memcard_register();

	/*start_memcard();*/
	mkdir("/ssd", 0777);
	mount("/dev/flash5", "/ssd", "yaffs", RTEMS_FILESYSTEM_READ_WRITE, "");
	/*
	 * Older versions of RTEMS-YAFFS created the file system with the
	 * (persistent) root inode set to 0666. RTEMS didn't check permissions
	 * at that time but does now, causing most operations to fail (EACCES)
	 * on file systems created before the transition.
	 *
	 * The "chmod" below transparently updates the permission of /ssd files
	 * systems.
	 */
	chmod("/ssd", YAFFS_ROOT_MODE);
	
	init_version();
	load_usb_firmware();
	init_videoinreconf();

	sysconfig_load();
	rtems_bsdnet_initialize_network();
	rtems_initialize_ftpd();
	rtems_telnetd_initialize();
	curl_global_init(CURL_GLOBAL_ALL);

	sc = rtems_task_create(rtems_build_name('G', 'U', 'I', ' '), 9, 1024*1024,
		RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR,
		0, &gui_task_id);
	assert(sc == RTEMS_SUCCESSFUL);
	sc = rtems_task_start(gui_task_id, gui_task, 0);
	assert(sc == RTEMS_SUCCESSFUL);

	rtems_task_delete(RTEMS_SELF);
}
Пример #2
0
t_version get_current_version( void ){
  t_version ret;
  init_version( &ret, 
		CURRENT_VERSION_MAJOR,
		CURRENT_VERSION_MINOR,
		CURRENT_VERSION_BUILD,
		CURRENT_VERSION_BRAND );
  return ret;
}
void
QcOfflineCacheDatabase::create_tables()
{
  // # https://www.sqlite.org/autoinc.html
  // # Fixme: how to handle auto-increment overflow ?

  QList<QString> schemas;

  const QString metadata_schema =
    "CREATE TABLE metadata ("
    "version INTEGER"
    ")";
  schemas << metadata_schema;

  const QString provider_schema =
    "CREATE TABLE provider ("
    "provider_id INTEGER PRIMARY KEY AUTOINCREMENT,"
    "name TEXT NOT NULL"
    ")";
  schemas << provider_schema;

  const QString map_level_schema =
    "CREATE TABLE map_level ("
    "map_level_id INTEGER PRIMARY KEY AUTOINCREMENT,"
    "provider_id INTEGER, "
    "map_id INTEGER, "
    "level INTEGER, "
    "FOREIGN KEY(provider_id) REFERENCES provider_id(provider_id)"
    ")";
  schemas << map_level_schema;

  //  PRIMARY KEY (map_level_id, row, column),
  const QString tile_schema =
    "CREATE TABLE tile ("
    "map_level_id INTEGER, "
    "row INTEGER, "
    "column INTEGER, "
    "offline_count INTEGER, "
    "FOREIGN KEY(map_level_id) REFERENCES map_level(map_level_id)"
    ")";
  schemas << tile_schema;

  QSqlQuery query = new_query();
  for (const auto & sql_query : schemas)
    if (!query.exec(sql_query))
      qWarning() << query.lastError().text();

  init_version();
  commit();
}
Пример #4
0
void *my_generate_key(const void *data)
{
    const char *line = data;
    size_t l;
    char *s, *p;
    char *string;
    struct beeversion *v;

    string = strdup(line);

    if(!string) {
        perror("calloc(s)");
        return NULL;
    }

    s = string;
    l = strlen(s);
    p = s+l-1;

    while (p > s && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r'))
        *(p--) = 0;

    while (*s && (*s == ' ' || *s == '\t'))
        s++;

    if(p < s) {
        free(string);
        errno = EINVAL;
        return NULL;
    }

    v = calloc(1, sizeof(*v));
    if(!v) {
        perror("calloc(beeversion)");
        free(string);
        return NULL;
    }

    if(parse_version(s, v) != 0) {
        free(v->string);
        init_version(s, v);
        v->pkgname = v->string;
    }

    free(string);

    return v;
}