<GMappedFile>

<GMappedFile>

Description

The GMappedFile represents a file mapping created with g_mapped_file_new(). It has only private members and should not be accessed directly.

Functions

free

(define-values () (mapped-file:free self))

This call existed before GMappedFile had refcounting and is currently exactly the same as g_mapped_file_unref().

Parameters

file

a GMappedFile

Passed as self

get-bytes

(define-values (%return) (mapped-file:get-bytes self))

Creates a new GBytes which references the data mapped from file. The mapped contents of the file must not be modified after creating this bytes object, because a GBytes should be immutable.

Parameters

file

a GMappedFile

Passed as self

get-contents

(define-values (%return) (mapped-file:get-contents 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 NULL is returned.

Parameters

file

a GMappedFile

Passed as self

get-length

(define-values (%return) (mapped-file:get-length self))

Returns the length of the contents of a GMappedFile.

Parameters

file

a GMappedFile

Passed as self

ref

(define-values (%return) (mapped-file:ref self))

Increments the reference count of file by one. It is safe to call this function from any thread.

Parameters

file

a GMappedFile

Passed as self

unref

(define-values () (mapped-file:unref self))

Decrements the reference count of file by one. If the reference count drops to 0, unmaps the buffer of file and frees it.

It is safe to call this function from any thread.

Since 2.22

Parameters

file

a GMappedFile

Passed as self

mapped-file:new-from-fd

(define-values (%return) (mapped-file:new-from-fd fd writable))

Undocumented

Parameters

fd

Passed as fd

writable

Passed as writable

mapped-file:new

(define-values (%return) (mapped-file:new filename writable))

Undocumented

Parameters

filename

Passed as filename

writable

Passed as writable