Nix 2.17.0
Nix, the purely functional package manager; stable external interfaces
All Data Structures Files Functions Variables Typedefs Modules Pages
nix_api_util.h
Go to the documentation of this file.
1#ifndef NIX_API_UTIL_H
2#define NIX_API_UTIL_H
17#ifdef __cplusplus
18extern "C" {
19#endif
20// cffi start
21
48// Error codes
59typedef int nix_err;
60
67#define NIX_OK 0
68
75#define NIX_ERR_UNKNOWN -1
76
83#define NIX_ERR_OVERFLOW -2
84
91#define NIX_ERR_KEY -3
92
99#define NIX_ERR_NIX_ERROR -4
100
120typedef struct nix_c_context nix_c_context;
121
122// Function prototypes
123
151
170nix_err nix_setting_get(nix_c_context *context, const char *key, char *value,
171 int n);
172
187nix_err nix_setting_set(nix_c_context *context, const char *key,
188 const char *value);
189
193// todo: nix_plugins_init()
194
201const char *nix_version_get();
202
220const char *nix_err_msg(nix_c_context *context, const nix_c_context *ctx,
221 unsigned int *n);
222
239 const nix_c_context *read_context, char *value, int n);
240
256nix_err nix_err_name(nix_c_context *context, const nix_c_context *read_context,
257 char *value, int n);
258
269nix_err nix_err_code(const nix_c_context *read_context);
270
275// cffi end
276#ifdef __cplusplus
277}
278#endif
279
281#endif // NIX_API_UTIL_H
nix_err nix_err_info_msg(nix_c_context *context, const nix_c_context *read_context, char *value, int n)
Retrieves the error message from errorInfo in a context.
nix_err nix_err_name(nix_c_context *context, const nix_c_context *read_context, char *value, int n)
Retrieves the error name from a context.
nix_c_context * nix_c_context_create()
Allocate a new nix_c_context.
int nix_err
Type for error codes in the NIX system.
Definition: nix_api_util.h:59
void nix_c_context_free(nix_c_context *context)
Free a nix_c_context. Does not fail.
const char * nix_err_msg(nix_c_context *context, const nix_c_context *ctx, unsigned int *n)
Retrieves the most recent error message from a context.
nix_err nix_err_code(const nix_c_context *read_context)
Retrieves the most recent error code from a nix_c_context.
const char * nix_version_get()
Retrieves the nix library version.
nix_err nix_libutil_init(nix_c_context *context)
Initializes nix_libutil and its dependencies.
nix_err nix_setting_set(nix_c_context *context, const char *key, const char *value)
Sets a setting in the nix global configuration.
nix_err nix_setting_get(nix_c_context *context, const char *key, char *value, int n)
Retrieves a setting from the nix global configuration.
This object stores error state.