lib, eshi: add evl_get_version()

Returns version information about the running EVL interface including
the API and kernel ABI levels. A negative ABI level denotes the EVL
shim layer (eshi).
This commit is contained in:
Philippe Gerum 2019-11-13 09:25:53 +01:00
parent cba6a9958b
commit 154e577193
5 changed files with 33 additions and 3 deletions

View File

@ -43,3 +43,11 @@ bool eshi_is_initialized(void)
{
return init_status == 0;
}
struct evl_version evl_get_version(void)
{
return (struct evl_version){
.api_level = __EVL__,
.abi_level = -1,
};
}

View File

@ -9,7 +9,12 @@
#include <evl/syscall.h>
#define __EVL__ 5 /* API revision */
#define __EVL__ 6 /* API version */
struct evl_version {
int api_level; /* libevl.so: __EVL__ */
int abi_level; /* core: EVL_ABI_LEVEL, -1 for ESHI */
};
#ifdef __cplusplus
extern "C" {
@ -17,6 +22,8 @@ extern "C" {
int evl_init(void);
struct evl_version evl_get_version(void);
#ifdef __cplusplus
}
#endif

View File

@ -20,7 +20,12 @@
#include <evl/poll.h>
#include <evl/proxy.h>
#define __EVL__ 6 /* API revision */
#define __EVL__ 7 /* API version */
struct evl_version {
int api_level; /* libevl.so: __EVL__ */
int abi_level; /* core: EVL_ABI_LEVEL, -1 for ESHI */
};
#ifdef __cplusplus
extern "C" {
@ -36,6 +41,8 @@ unsigned int evl_detect_fpu(void);
extern const char *libevl_version_string;
struct evl_version evl_get_version(void);
#ifdef __cplusplus
}
#endif

View File

@ -251,3 +251,11 @@ unsigned int evl_detect_fpu(void)
return core_info.fpu_features;
}
struct evl_version evl_get_version(void)
{
return (struct evl_version){
.api_level = __EVL__,
.abi_level = EVL_ABI_LEVEL,
};
}

View File

@ -42,7 +42,7 @@ static void usage(void)
{
fprintf(stderr, "usage: evl [options] <command> [<args>]\n");
fprintf(stderr, "-P --prefix=<path> set command path prefix\n");
fprintf(stderr, "-V --version print version and required ABI revision\n");
fprintf(stderr, "-V --version print library and required ABI versions\n");
}
#define short_optlist "+P:V"