+/** \brief see if the fcntl locking is not POSIX
+ *
+ * The default posix_locks=1 is assumed.. This function sets posix_locks
+ * to zero if linuxthreads is in use.
+ */
+static int check_for_linuxthreads(void)
+{
+#if __linux
+#ifdef _CS_GNU_LIBPTHREAD_VERSION
+ char conf_buf[512];
+ size_t r = confstr(_CS_GNU_LIBPTHREAD_VERSION, conf_buf, sizeof(conf_buf));
+ if (r == 0)
+ {
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "confstr failed");
+ return -1;
+ }
+ if (strncmp(conf_buf, "linuxthreads", 12) == 0)
+ posix_locks = 0; /* Using linuxthreads.. */
+#else
+ posix_locks = 0; /* Old GLIBC on Linux. Assume linuxthreads */
+#endif
+#endif
+ return 0;
+}
+
+void zebra_flock_init()
+{
+ if (!initialized)
+ {
+ initialized = 1;
+ log_level = yaz_log_module_level("flock");
+ yaz_log(log_level, "zebra_flock_init");
+ check_for_linuxthreads();
+ zebra_mutex_init(&lock_list_mutex);
+ yaz_log(log_level, "posix_locks: %d", posix_locks);
+ }
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+