FreeBSD/sys/dev/drm2/drm_bufs.c
/**
 * Ioctl to specify a range of memory that is available for mapping by a
 * non-root process.
 *
 * \param inode device inode.
 * \param file_priv DRM file private.
 * \param cmd command.
 * \param arg pointer to a drm_map structure.
 * \return zero on success or a negative value on error.
 *
 */
Ioctl to specify a range of memory that is available for mapping by a
non-root process.

\param inode device inode.
\param file_priv DRM file private.
\param cmd command.
\param arg pointer to a drm_map structure.
\return zero on success or a negative value on error.
Ioctl to specify a range of memory that is available for mapping by a non - root process . \ param inode device inode . \ param file_priv DRM file private . \ param cmd command . \ param arg pointer to a drm_map structure . \ return zero on success or a negative value on error .
int drm_addmap_ioctl(struct drm_device *dev, void *data,
		     struct drm_file *file_priv)
{
	struct drm_map *map = data;
	struct drm_map_list *maplist;
	int err;
	if (!(DRM_SUSER(DRM_CURPROC) || map->type == _DRM_AGP || map->type == _DRM_SHM))
		return -EPERM;
	err = drm_addmap_core(dev, map->offset, map->size, map->type,
			      map->flags, &maplist);
	if (err)
		return err;
	map->handle = (void *)(unsigned long)maplist->user_token;
	return 0;
}
int drm_addmap_ioctl ( struct drm_device * dev , void * data , struct drm_file * file_priv ) { struct drm_map * map = data ; struct drm_map_list * maplist ; int err ; if ( ! ( DRM_SUSER ( DRM_CURPROC ) || map -> type == _DRM_AGP || map -> type == _DRM_SHM ) ) return - EPERM ; err = drm_addmap_core ( dev , map -> offset , map -> size , map -> type , map -> flags , & maplist ) ; if ( err ) return err ; map -> handle = ( void * ) ( unsigned long ) maplist -> user_token ; return 0 ; }
Ioctl to specify a range of memory that is available for mapping by a
 non-root process.
Ioctl to specify a range of memory that is available for mapping by a non - root process .
/* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */