* Rob Clark <robclark@freedesktop.org>
*/
+#include <errno.h>
+#include <fcntl.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <stdio.h>
#ifdef HAVE_LIBUDEV
#include <assert.h>
#include <dlfcn.h>
-#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
#ifdef USE_DRICONF
#include "xmlconfig.h"
#include "xmlpool.h"
static void (*log_)(int level, const char *fmt, ...) = default_logger;
+int
+loader_open_device(const char *device_name)
+{
+ int fd;
+#ifdef O_CLOEXEC
+ fd = open(device_name, O_RDWR | O_CLOEXEC);
+ if (fd == -1 && errno == EINVAL)
+#endif
+ {
+ fd = open(device_name, O_RDWR);
+ if (fd != -1)
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+ }
+ return fd;
+}
+
#ifdef HAVE_LIBUDEV
#include <libudev.h>
return id_path_tag;
}
-int
-loader_open_device(const char *device_name)
-{
- int fd;
-#ifdef O_CLOEXEC
- fd = open(device_name, O_RDWR | O_CLOEXEC);
- if (fd == -1 && errno == EINVAL)
-#endif
- {
- fd = open(device_name, O_RDWR);
- if (fd != -1)
- fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
- }
- return fd;
-}
-
#ifdef USE_DRICONF
const char __driConfigOptionsLoader[] =
DRI_CONF_BEGIN