int _ump_uku_map_mem(_ump_uk_map_mem_s *args)
{
	int flags;

	if (-1 == (int)args->ctx)
	{
		return -1;
	}

	flags = MAP_SHARED;

	/* This is for backwards compatibillity */
	if (MAKE_VERSION_ID(1) == ump_ioctl_api_version_used)
	{
		args->is_cached = 0;
	}

	/* If we want the Caching to be enabled we set the flags to be PRIVATE. The UMP DD reads this and do proper handling
	   Note: this enforces the user to use proper invalidation*/
	if (args->is_cached)
	{
		flags = MAP_PRIVATE;
	}

	args->mapping = mmap(NULL, args->size, PROT_READ | PROT_WRITE , flags , (int)args->ctx, (off_t)args->secure_id * sysconf(_SC_PAGE_SIZE));

	if (MAP_FAILED == args->mapping)
	{
		return -1;
	}

	args->cookie = 0; /* Cookie is not used in linux _ump_uku_unmap_mem */

	return 0;
}
예제 #2
0
파일: application.cpp 프로젝트: LaloHao/rme
void Application::FixVersionDiscrapencies() 
{
	// Here the registry should be fixed, if the version has been changed
	if(settings.getInteger(Config::VERSION_ID) < MAKE_VERSION_ID(1, 0, 5)) 
	{
		settings.setInteger(Config::USE_MEMCACHED_SPRITES_TO_SAVE, 0);
	}

	if(settings.getInteger(Config::VERSION_ID) < __RME_VERSION_ID__ && ClientVersion::getLatestVersion() != nullptr)
	{
		settings.setInteger(Config::DEFAULT_CLIENT_VERSION, ClientVersion::getLatestVersion()->getID());
	}

	wxString ss = wxstr(settings.getString(Config::SCREENSHOT_DIRECTORY));
	if(ss.empty())
	{
		ss = wxStandardPaths::Get().GetDocumentsDir();
#ifdef __WINDOWS__
		ss += wxT("/My Pictures/RME/");
#endif
	}
	settings.setString(Config::SCREENSHOT_DIRECTORY, nstr(ss));

	// Set registry to newest version
	settings.setInteger(Config::VERSION_ID, __RME_VERSION_ID__);
}
_ump_osu_errcode_t _ump_uku_open(void **context)
{
	int ump_device_file;

	if (NULL == context)
	{
		return _UMP_OSU_ERR_FAULT;
	}

	ump_device_file = open(ump_device_file_name, O_RDWR);

	if (-1 == ump_device_file)
	{
		return _UMP_OSU_ERR_FAULT;
	}

	{
		struct _ump_uk_api_version_s args;
		args.ctx     = (void *)ump_device_file;
		args.version = UMP_IOCTL_API_VERSION;
		args.compatible = 3;
		ump_driver_ioctl(args.ctx, UMP_IOC_QUERY_API_VERSION, &args);

		if (1 != args.compatible)
		{
			if (IS_API_MATCH(MAKE_VERSION_ID(1), args.version))
			{
				ump_ioctl_api_version_used = MAKE_VERSION_ID(1);
				UMP_PRINTF("The UMP devicedriver does not support cached UMP. Update it if this is needed.\n");
			}
			else
			{
				UMP_PRINTF("The UMP devicedriver is version: %d, UMP libraries is version: %d.\n", GET_VERSION(args.version), GET_VERSION(UMP_IOCTL_API_VERSION));
				close(ump_device_file);
				return _UMP_OSU_ERR_FAULT;
			}
		}
	}

	*context = (void *) ump_device_file;
	return _UMP_OSU_ERR_OK;
}
void _ump_uku_msynch(_ump_uk_msync_s *args)
{
	/* This is for backwards compatibillity */
	if (MAKE_VERSION_ID(1) == ump_ioctl_api_version_used)
	{
		args->is_cached = 0;

		if (_UMP_UK_MSYNC_READOUT_CACHE_ENABLED != args->op)
		{
			UMP_DEBUG_PRINT(3, ("Warning: Doing UMP cache flush operations on a Device Driver that does not support cached UMP mem.\n"));
		}

		return;
	}

	ump_driver_ioctl(args->ctx, UMP_IOC_MSYNC, args);
}