+/* Returns true if 'filename' is known to be already open as a database,
+ * false if not.
+ *
+ * "False negatives" are possible. */
+static bool
+is_already_open(struct server_config *config OVS_UNUSED,
+ const char *filename OVS_UNUSED)
+{
+#ifndef _WIN32
+ struct stat s;
+
+ if (!stat(filename, &s)) {
+ struct shash_node *node;
+
+ SHASH_FOR_EACH (node, config->all_dbs) {
+ struct db *db = node->data;
+ struct stat s2;
+
+ if (!stat(db->filename, &s2)
+ && s.st_dev == s2.st_dev
+ && s.st_ino == s2.st_ino) {
+ return true;
+ }
+ }
+ }
+#endif /* !_WIN32 */
+
+ return false;
+}
+