rtl-file

rtl-file —

Synopsis




gpointer    captive_rtl_file_mmap           (size_t *lenp,
                                             const gchar *path,
                                             int open_flags,
                                             int mmap_prot,
                                             int mmap_flags);
void        captive_rtl_file_munmap         (gpointer base);
gpointer    captive_rtl_file_read           (gint fd,
                                             gsize *bufsizep);

Description

Details

captive_rtl_file_mmap ()

gpointer    captive_rtl_file_mmap           (size_t *lenp,
                                             const gchar *path,
                                             int open_flags,
                                             int mmap_prot,
                                             int mmap_flags);

mmap(2) the whole file into memory.

lenp : returns the file length if successful. NULL pointer permitted.
path : File pathname to open(2).
open_flags : open(2) parameter flags such as O_RDONLY.
mmap_prot : mmap(2) parameter prot such as PROT_READ.
mmap_flags : mmap(2) parameter flags such as MAP_SHARED.
Returns : address base with mmap(2)ed file (and lenp filled) or NULL if error.

captive_rtl_file_munmap ()

void        captive_rtl_file_munmap         (gpointer base);

munmap(2) the whole file and destroy all its resources.

base : file base address returned by captive_rtl_file_mmap(). NULL pointer forbidden.

captive_rtl_file_read ()

gpointer    captive_rtl_file_read           (gint fd,
                                             gsize *bufsizep);

Reads the whole file into memory.

fd : file-descriptor to read data from.
bufsizep : Returns the size of resulting data. NULL pointer is permitted.
Returns : address base of the memory being filled with file contents. Free the area by g_free() if no longer used.