libctf: build system
[deliverable/binutils-gdb.git] / libctf / ctf-subr.c
index 3103e28a3f3d62c27db4c9f616296713899ea160..09ec2951e5419d7ced577571a5107e6f6302542c 100644 (file)
@@ -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)
 {
This page took 0.024876 seconds and 4 git commands to generate.