From: Waldemar Kozaczuk <jwkozac...@gmail.com> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
add another C-wrapper: osv_run_app() In preparation to support building and running ZFS images on the kernel built with most symbols hidden, this patch adds new C function - osv_run_app() - that wraps code to run an arbitrary app. This will allow an application like mkfs.so to be changed to not have to depend on C++ symbols like osv::run() from OSv kernel. Refs #1186 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- diff --git a/core/osv_c_wrappers.cc b/core/osv_c_wrappers.cc --- a/core/osv_c_wrappers.cc +++ b/core/osv_c_wrappers.cc @@ -143,6 +143,15 @@ void osv_current_app_on_termination_request(void (*handler)()) { osv::this_application::on_termination_request(handler); } +extern "C" OSV_MODULE_API +int osv_run_app(const char *app_path, const char *args[], int args_len) { + int ret; + std::vector<std::string> _args(args, args + args_len); + auto ok = run(app_path, _args, &ret); + assert(ok); + return ret; +} + extern bool verbose; extern "C" OSV_MODULE_API bool osv_debug_enabled() { diff --git a/exported_symbols/osv_module_api.symbols b/exported_symbols/osv_module_api.symbols --- a/exported_symbols/osv_module_api.symbols +++ b/exported_symbols/osv_module_api.symbols @@ -7,4 +7,5 @@ osv_get_all_app_threads osv_get_all_threads osv_hypervisor_name osv_processor_features +osv_run_app osv_version diff --git a/include/osv/osv_c_wrappers.h b/include/osv/osv_c_wrappers.h --- a/include/osv/osv_c_wrappers.h +++ b/include/osv/osv_c_wrappers.h @@ -127,6 +127,11 @@ bool osv_debug_enabled(); */ void osv_current_app_on_termination_request(void (*handler)()); +/* + * Start an app and wait until it terminates + */ +int osv_run_app(const char *app_path, const char *args[], int args_len); + #ifdef __cplusplus } #endif -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000537cf205e3407d99%40google.com.