Function

Idefoundry_bytes_to_memfd

Declaration

int
ide_foundry_bytes_to_memfd (
  GBytes* bytes,
  const char* name
)

Description

Writes all of bytes to a new memfd or tempfile and returns the file-descriptor. -1 is returned upon error.

if bytes is NULL, then a memfd/tempfile that is empty will be returned if successful.

Parameters

bytes

Type: GBytes

A GBytes or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
name

Type: const char*

The name for the memfd or tempfile.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: int

-1 upon failure, otherwise a file-descriptor.