memobj_map()
Map a graphics memory object into a process's virtual memory
Synopsis:
#include <memobj/virtmem.h>
errno_t memobj_map(void **vaddr_out, struct memobj *obj, int pid, int prot, off64_t offset, size_t nbytes)
Arguments:
- vaddr_out
-
A pointer to a
void*where this function, if successful, writes the virtual address at which the memory was mapped. - obj
- A handle to the memory object you want to map. The mapping is associated with this handle, and is deleted when it's closed.
- pid
-
0to map into the calling process; or a process ID specifying the process in which this object shall be mapped. - prot
-
The access capabilities that you want to use for the memory region being mapped, as for mmap(). Normally
PROT_READ | PROT_WRITE. - offset
- An offset into the memory object, at which the mapping will start.
- nbytes
-
The number of bytes to map (starting from offset). If
0, map as many bytes as possible.
Library:
libmemobjDescription:
The memobj_map() function maps a graphics memory object into a process's virtual memory. The object doesn't have to be locked.
Returns:
- EOK
-
Success; the memory was mapped, and the address (in the process corresponding to pid), was stored in
*addr_out.
- EACCES
- The wrapped file descriptor isn't usable.
- EAGAIN
- The mapping couldn't be locked in memory, if required by mlockall(), because of a lack of resources.
- EBADF
- The gd is invalid, or the wrapped file descriptor is invalid.
- EBUSY
- The resource you're trying to map is busy.
- EINVAL
- A parameter is invalid.
- EMFILE
- The number of mapped regions is at its maximum limit; Refer to the RLIMIT_AS and RLIMIT_DATA resources for setrlimit().
- ENODEV
- The wrapped file descriptor doesn't support mmap().
- ENOMEM
- There isn't enough free memory or address space; MAP_FAILED was specified and the mapping would have extended outside the allowed address range, or the mapping couldn't be locked in memory as required by mlockall().
- ENXIO
- The mapping would have extended outside the valid range for this object.
- EOVERFLOW
-
offset + nbyteswould exceed the maximum offset.
- EPERM
- PROT_EXEC isn't allowed for this object.
- ESRCH
- The PID isn't valid.
Page updated:
