crun
                                
                                
                                
                                    crun copied to clipboard
                            
                            
                            
                        Needs a header for libcrun
crun expose a static archive(or even shared library if you want) for user, but lacks a good header file to use it. If I want to use libcrun in my project. I have to add crun functions declarations by hand.
Maybe we can clean container.h and error.h to make it usable as public header and install them to $(PREFIX)/include/crun for user.
yes, the main problem with the current headers is that they don't split correctly between what is public and what is used internally.
How are you planning to use libcrun? I am asking so perhaps we can figure out something simple you can use in the meanwhile we cleanup our header files.
How are you planning to use libcrun? I am asking so perhaps we can figure out something simple you can use in the meanwhile we cleanup our header files.
My use case is create a binding of libcrun for Guile programming langauge, similar to the python binding already provided by crun.
if you would like, the bindings can be added to this git repo and be maintained here.
I've done some cleanup for the API:
- api: unexport some functions #828
 
Getting to a usable header file will take some more time, now the public functions are just in few files (git grep "LIBCRUN_PUBLIC .* libcrun_" src/libcrun/*.h):
src/libcrun/container.h:LIBCRUN_PUBLIC libcrun_container_t *libcrun_container_load_from_file (const char *path, libcrun_error_t *err);
src/libcrun/container.h:LIBCRUN_PUBLIC libcrun_container_t *libcrun_container_load_from_memory (const char *json, libcrun_error_t *err);
src/libcrun/container.h:LIBCRUN_PUBLIC void libcrun_container_free (libcrun_container_t *);
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_run (libcrun_context_t *context, libcrun_container_t *container,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_delete (libcrun_context_t *context, runtime_spec_schema_config_schema *def,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_kill (libcrun_context_t *context, const char *id, const char *signal,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_killall (libcrun_context_t *context, const char *id, const char *signal,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_create (libcrun_context_t *context, libcrun_container_t *container,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_start (libcrun_context_t *context, const char *id, libcrun_error_t *err);
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_state (libcrun_context_t *context, const char *id, FILE *out,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_get_container_state_string (const char *id, libcrun_container_status_t *status,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_exec_with_options (libcrun_context_t *context, const char *id,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_exec (libcrun_context_t *context, const char *id,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_exec_process_file (libcrun_context_t *context, const char *id, const char *path,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_update (libcrun_context_t *context, const char *id, const char *content,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_update_from_file (libcrun_context_t *context, const char *id, const char *file,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_spec (bool root, FILE *out, libcrun_error_t *err);
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_pause (libcrun_context_t *context, const char *id, libcrun_error_t *err);
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_unpause (libcrun_context_t *context, const char *id, libcrun_error_t *err);
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_checkpoint (libcrun_context_t *context, const char *id,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_restore (libcrun_context_t *context, const char *id,
src/libcrun/container.h:LIBCRUN_PUBLIC int libcrun_container_read_pids (libcrun_context_t *context, const char *id, bool recurse, pid_t **pids, libcrun_error_t *err);
src/libcrun/custom-handler.h:LIBCRUN_PUBLIC int libcrun_handler_manager_load_directory (struct custom_handler_manager_s *manager, const char *path, libcrun_error_t *err);
src/libcrun/custom-handler.h:LIBCRUN_PUBLIC void libcrun_handler_manager_print_feature_tags (struct custom_handler_manager_s *manager, FILE *out);
src/libcrun/custom-handler.h:LIBCRUN_PUBLIC int libcrun_configure_handler (struct custom_handler_manager_s *manager,
src/libcrun/error.h:LIBCRUN_PUBLIC void libcrun_warning (const char *msg, ...);
src/libcrun/error.h:LIBCRUN_PUBLIC void libcrun_error (int errno_, const char *msg, ...);
src/libcrun/error.h:LIBCRUN_PUBLIC int libcrun_make_error (libcrun_error_t *err, int status, const char *msg, ...);
src/libcrun/error.h:LIBCRUN_PUBLIC void libcrun_error_write_warning_and_release (FILE *out, libcrun_error_t **err);
src/libcrun/error.h:LIBCRUN_PUBLIC void libcrun_fail_with_error (int errno_, const char *msg, ...) __attribute__ ((noreturn));
src/libcrun/error.h:LIBCRUN_PUBLIC int libcrun_set_log_format (const char *format, libcrun_error_t *err);
src/libcrun/error.h:LIBCRUN_PUBLIC int libcrun_init_logging (crun_output_handler *output_handler, void **output_handler_arg, const char *id,
src/libcrun/error.h:LIBCRUN_PUBLIC int libcrun_error_release (libcrun_error_t *err);
src/libcrun/error.h:LIBCRUN_PUBLIC void libcrun_set_verbosity (int verbosity);
src/libcrun/error.h:LIBCRUN_PUBLIC int libcrun_get_verbosity ();
src/libcrun/seccomp_notify.h:LIBCRUN_PUBLIC int libcrun_load_seccomp_notify_plugins (struct seccomp_notify_context_s **out, const char *plugins,
src/libcrun/seccomp_notify.h:LIBCRUN_PUBLIC int libcrun_seccomp_notify_plugins (struct seccomp_notify_context_s *ctx, int seccomp_fd,
src/libcrun/seccomp_notify.h:LIBCRUN_PUBLIC int libcrun_free_seccomp_notify_plugins (struct seccomp_notify_context_s *ctx, libcrun_error_t *err);
src/libcrun/status.h:LIBCRUN_PUBLIC void libcrun_free_container_status (libcrun_container_status_t *status);
src/libcrun/status.h:LIBCRUN_PUBLIC int libcrun_write_container_status (const char *state_root, const char *id,
src/libcrun/status.h:LIBCRUN_PUBLIC int libcrun_read_container_status (libcrun_container_status_t *status, const char *state_root,
src/libcrun/status.h:LIBCRUN_PUBLIC void libcrun_free_containers_list (libcrun_container_list_t *list);
src/libcrun/status.h:LIBCRUN_PUBLIC int libcrun_is_container_running (libcrun_container_status_t *status, libcrun_error_t *err);
src/libcrun/status.h:LIBCRUN_PUBLIC int libcrun_container_delete_status (const char *state_root, const char *id, libcrun_error_t *err);
src/libcrun/status.h:LIBCRUN_PUBLIC int libcrun_get_containers_list (libcrun_container_list_t **ret, const char *state_root,
there are some dependencies on libocispec as well.
I don't think it will be a trivial job to get these headers in a shape to be installable and not require additional dependencies.