The <GMappedFile> represents a file mapping
created with mapped-file:new. It has only
private members and should not be accessed directly.
This call existed before <GMappedFile> had
refcounting and is currently exactly the same as mapped-file:unref.
Passed: a <GMappedFile>.
Creates a new <GBytes> which references the data
mapped from self. The mapped contents of the file must not be
modified after creating this bytes object, because a
<GBytes> should be immutable.
Passed: a <GMappedFile>.
Returned: a <GBytes>.
A newly allocated <GBytes> referencing data from
self
Returns the contents of a <GMappedFile>.
Note that the contents may not be zero-terminated, even if the
<GMappedFile> is backed by a text file.
If the file is empty then #f is returned.
Passed: a <GMappedFile>.
Returned: a string, or #f.
the contents of self, or #f.
Returns the length of the contents of a
<GMappedFile>.
Passed: a <GMappedFile>.
Returned: an unsigned 64-bit integer.
the length of the contents of self.
Maps a file into memory. On UNIX, this is using the mmap()
function.
If writable is #t, the mapped buffer may be modified,
otherwise it is an error to modify the mapped buffer. Modifications to
the buffer are not visible to other processes mapping the same file, and
are not written back to the file.
Note that modifications of the underlying file might affect the contents
of the <GMappedFile>. Therefore, mapping
should only be used if the file will not be modified, or if all
modifications of the file are done atomically (e.g. using
file-set-contents?).
If filename is the name of an empty, regular file, the function
will successfully return an empty
<GMappedFile>. In other cases of size 0 (e.g.
device files such as /dev/null), error will be set to the
<%GFileError> value
inval.
Passed: a file name, as a string.
The path of the file to load, in the GLib filename encoding
Passed: a boolean.
whether the mapping should be writable
Returned: a <GMappedFile>.
a newly allocated <GMappedFile> which must be
unref’d with mapped-file:unref, or
#f if the mapping failed.
Maps a file into memory. On UNIX, this is using the mmap()
function.
If writable is #t, the mapped buffer may be modified,
otherwise it is an error to modify the mapped buffer. Modifications to
the buffer are not visible to other processes mapping the same file, and
are not written back to the file.
Note that modifications of the underlying file might affect the contents
of the <GMappedFile>. Therefore, mapping
should only be used if the file will not be modified, or if all
modifications of the file are done atomically (e.g. using
file-set-contents?).
Passed: a 32-bit integer.
The file descriptor of the file to load
Passed: a boolean.
whether the mapping should be writable
Returned: a <GMappedFile>.
a newly allocated <GMappedFile> which must be
unref’d with mapped-file:unref, or
#f if the mapping failed.
Increments the reference count of self by one. It is safe to call this function from any thread.
Passed: a <GMappedFile>.
Returned: a <GMappedFile>.
the passed in <GMappedFile>.
Decrements the reference count of self by one. If the reference count drops to 0, unmaps the buffer of self and frees it.
It is safe to call this function from any thread.
Since 2.22
Passed: a <GMappedFile>.