The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
query.c File Reference

librat: the queries. More...

#include "internal.h"
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>

Functions

int rat_info (rat_t *rat, const char *name, rat_info_t *info_out, rat_error_t *err)
 the fields of an installed package.
int rat_files (rat_t *rat, const char *name, rat_entry_t **entries_out, int *count_out, rat_error_t *err)
 the folders, files and links of an installed package, sorted by path.
int rat_list (rat_t *rat, rat_info_t **infos_out, int *count_out, rat_error_t *err)
 the installed packages, sorted by name.
int rat_owner (rat_t *rat, const char *path, char name_out[RAT_NAME_MAX+1], rat_error_t *err)
 which package owns a path.
int rat_verify (rat_t *rat, const char *name, rat_note_t note, void *context, int *problems_out, rat_error_t *err)
 compare the files of an installed package with the record: a missing file, another type, other permissions, other data.

Detailed Description

librat: the queries.

the installed packages, their fields and files, the owner of a path, and the check of installed files.

Function Documentation

◆ rat_info()

int rat_info ( rat_t * rat,
const char * name,
rat_info_t * info_out,
rat_error_t * err )

the fields of an installed package.

Returns
0, or -1 (also when it is not installed).

◆ rat_files()

int rat_files ( rat_t * rat,
const char * name,
rat_entry_t ** entries_out,
int * count_out,
rat_error_t * err )

the folders, files and links of an installed package, sorted by path.

Parameters
entries_outgets an array to free with rat_entries_free.
Returns
0, or -1.

◆ rat_list()

int rat_list ( rat_t * rat,
rat_info_t ** infos_out,
int * count_out,
rat_error_t * err )

the installed packages, sorted by name.

Parameters
infos_outgets an array to free with rat_infos_free.
Returns
0, or -1.

◆ rat_owner()

int rat_owner ( rat_t * rat,
const char * path,
char name_out[RAT_NAME_MAX+1],
rat_error_t * err )

which package owns a path.

Parameters
pathan absolute path on the root, as "/usr/bin/lua".
name_outgets the package name, or "" when the base image owns the path.
Returns
0, or -1 when nothing owns it.

◆ rat_verify()

int rat_verify ( rat_t * rat,
const char * name,
rat_note_t note,
void * context,
int * problems_out,
rat_error_t * err )

compare the files of an installed package with the record: a missing file, another type, other permissions, other data.

Parameters
notegets one line for each difference.
problems_outgets the number of differences.
Returns
0, or -1 (the package is not installed).