Method
MtkAnonymousFileopen_fd
Declaration [src]
int
mtk_anonymous_file_open_fd (
const MtkAnonymousFile* file,
MtkAnonymousFileMapmode mapmode
)
Description [src]
Returns a file descriptor for the given file, ready to be sent to a client.
The returned file descriptor must not be shared between multiple clients.
If mapmode
is MTK_ANONYMOUS_FILE_MAPMODE_PRIVATE
the file descriptor is
only guaranteed to be mmapable with MAP_PRIVATE. If mapmode
is
MTK_ANONYMOUS_FILE_MAPMODE_SHARED
the file descriptor can be mmaped with
either MAP_PRIVATE or MAP_SHARED.
In case MTK_ANONYMOUS_FILE_MAPMODE_PRIVATE
is used, it is important to
only read the returned fd using mmap()
since using read()
will move the
read cursor of the fd and thus may cause read()
calls on other returned
fds to fail.
When done using the fd, it is required to call mtk_anonymous_file_close_fd()
instead of close().
If this function fails errno is set.
This method is not directly available to language bindings.
Parameters
mapmode
-
Type:
MtkAnonymousFileMapmode
Describes the ways in which the returned file descriptor can be used with mmap.