diff options
Diffstat (limited to 'libctf/ctf-subr.c')
-rw-r--r-- | libctf/ctf-subr.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libctf/ctf-subr.c b/libctf/ctf-subr.c index 3103e28..09ec295 100644 --- a/libctf/ctf-subr.c +++ b/libctf/ctf-subr.c @@ -27,6 +27,7 @@ #include <unistd.h> static size_t _PAGESIZE _libctf_unused_; +int _libctf_version = CTF_VERSION; /* Library client version. */ int _libctf_debug = 0; /* Debugging messages enabled. */ _libctf_malloc_ void * @@ -190,6 +191,32 @@ ctf_strerror (int err) return (const char *) (strerror (err)); } +/* Set the CTF library client version to the specified version. If version is + zero, we just return the default library version number. */ +int +ctf_version (int version) +{ + if (version < 0) + { + errno = EINVAL; + return -1; + } + + if (version > 0) + { + /* Dynamic version switching is not presently supported. */ + if (version != CTF_VERSION) + { + errno = ENOTSUP; + return -1; + } + ctf_dprintf ("ctf_version: client using version %d\n", version); + _libctf_version = version; + } + + return _libctf_version; +} + void libctf_init_debug (void) { |