summaryrefslogtreecommitdiffstats
path: root/src/intel/common/gen_gem.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/common/gen_gem.h')
-rw-r--r--src/intel/common/gen_gem.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/intel/common/gen_gem.h b/src/intel/common/gen_gem.h
index 8df2c249e48..c4dda6de657 100644
--- a/src/intel/common/gen_gem.h
+++ b/src/intel/common/gen_gem.h
@@ -24,7 +24,9 @@
#ifndef GEN_GEM_H
#define GEN_GEM_H
+#include <errno.h>
#include <stdint.h>
+#include <sys/ioctl.h>
static inline uint64_t
gen_canonical_address(uint64_t v)
@@ -54,4 +56,18 @@ gen_48b_address(uint64_t v)
return (uint64_t)(v << shift) >> shift;
}
+/**
+ * Call ioctl, restarting if it is interupted
+ */
+static inline int
+gen_ioctl(int fd, unsigned long request, void *arg)
+{
+ int ret;
+
+ do {
+ ret = ioctl(fd, request, arg);
+ } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+ return ret;
+}
+
#endif /* GEN_GEM_H */