Crinit -- Configurable Rootfs Init
ioredir.c File Reference

(2023-08-02, commit: 9434b31)

Implementation of functions related to IO redirection. More...

#include "ioredir.h"
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "common.h"
#include "confconv.h"
#include "logio.h"
Include dependency graph for ioredir.c:

Functions

void crinitDestroyIoRedir (crinitIoRedir_t *ior)
 
int crinitIoRedirCpy (crinitIoRedir_t *dest, const crinitIoRedir_t *src)
 

Detailed Description

Implementation of functions related to IO redirection.

Function Documentation

◆ crinitDestroyIoRedir()

void crinitDestroyIoRedir ( crinitIoRedir_t ior)

Frees memory associated with an initialized instance of crinitIoRedir_t.

Parameters
iorThe instance whose associated memory shall be freed.

◆ crinitIoRedirCpy()

int crinitIoRedirCpy ( crinitIoRedir_t dest,
const crinitIoRedir_t src 
)

Initializes an instance of crinitIoRedir_t from an already initialized other instance.

The resulting instance will contain equal values to the original. If the original instance contains dynamically allocated elements, equivalent memory will be allocated in the new instance and all contents copied.

The function may allocate memory inside the crinitIoRedir_t struct which must be freed using crinitDestroyIoRedir().

Parameters
destThe crinitIoRedir_t instance to initialize.
srcThe source/original instance to copy data from.
Returns
0 on success, -1 otherwise