<div dir="ltr"><div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 3, 2019 at 2:02 AM Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Skip over non-existent files.<br>
Signed-off-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" target="_blank">jan.vesely@rutgers.edu</a>><br>
---<br>
This should help detect instances of messed up/missing symbols in the driver.<br>
windows build seems OK: <a href="https://ci.appveyor.com/project/jvesely/mesa/builds/23550498#L1292" rel="noreferrer" target="_blank">https://ci.appveyor.com/project/jvesely/mesa/builds/23550498#L1292</a><br>
 .../auxiliary/pipe-loader/pipe_loader.c       |  5 +-<br>
 src/gallium/auxiliary/util/u_file.h           | 58 +++++++++++++++++++<br>
 2 files changed, 62 insertions(+), 1 deletion(-)<br>
 create mode 100644 src/gallium/auxiliary/util/u_file.h<br>
<br>
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c<br>
index 6fd15527e53..fc8ee8e8dcd 100644<br>
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c<br>
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c<br>
@@ -31,6 +31,7 @@<br>
 #include "util/u_memory.h"<br>
 #include "util/u_string.h"<br>
 #include "util/u_dl.h"<br>
+#include "util/u_file.h"<br>
 #include "util/xmlconfig.h"<br>
 #include "util/xmlpool.h"<br>
<br>
@@ -158,11 +159,13 @@ pipe_loader_find_module(const char *driver_name,<br>
          ret = util_snprintf(path, sizeof(path), "%s%s%s",<br>
                              MODULE_PREFIX, driver_name, UTIL_DL_EXT);<br>
<br>
-      if (ret > 0 && ret < sizeof(path)) {<br>
+      if (ret > 0 && ret < sizeof(path) && u_file_access(path, 0) != -1) {<br>
          lib = util_dl_open(path);<br>
          if (lib) {<br>
             return lib;<br>
          }<br>
+         fprintf(stderr, "ERROR: Failed to load pipe driver at `%s': %s\n",<br>
+                         path, util_dl_error());<br>
       }<br>
    }<br>
<br>
diff --git a/src/gallium/auxiliary/util/u_file.h b/src/gallium/auxiliary/util/u_file.h<br>
new file mode 100644<br>
index 00000000000..f337dc9761e<br>
--- /dev/null<br>
+++ b/src/gallium/auxiliary/util/u_file.h<br>
@@ -0,0 +1,58 @@<br>
+/**************************************************************************<br>
+ *<br>
+ * Copyright 2009 VMware, Inc.<br>
+ * All Rights Reserved.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the<br>
+ * "Software"), to deal in the Software without restriction, including<br>
+ * without limitation the rights to use, copy, modify, merge, publish,<br>
+ * distribute, sub license, and/or sell copies of the Software, and to<br>
+ * permit persons to whom the Software is furnished to do so, subject to<br>
+ * the following conditions:<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,<br>
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR<br>
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE<br>
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the<br>
+ * next paragraph) shall be included in all copies or substantial portions<br>
+ * of the Software.<br>
+ *<br>
+ **************************************************************************/<br>
+<br>
+<br>
+#ifndef U_FILE_H_<br>
+#define U_FILE_H_<br>
+<br>
+#if defined(PIPE_OS_UNIX)<br>
+#include <unistd.h><br>
+#endif<br>
+#if defined(PIPE_OS_WINDOWS)<br>
+#include <io.h><br>
+#endif<br>
+<br>
+#ifdef __cplusplus<br>
+extern "C" {<br>
+#endif<br>
+<br>
+static inline int<br>
+u_file_access(const char *path, int mode) {<br>
+#if defined(PIPE_OS_UNIX)<br>
+       return access(path, mode);<br>
+#elif defined(PIPE_OS_WINDOWS)<br>
+       return _access(path, mode);<br>
+#else<br>
+       return 0;<br>
+#endif<br>
+}<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
+#endif /* U_FILE_H_ */<br>
-- <br>
2.21.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></blockquote></div>