[Beignet] [PATCH 2/3] Change the temporary file generated in android.
Yang Rong
rong.r.yang at intel.com
Sun Aug 31 20:15:33 PDT 2014
Android don't have mkstemps function, and don't have /tmp file system.
So use mkstemp and store the tmp files to /data/local/tmp.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
backend/src/backend/program.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 20471f9..293cf65 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -703,8 +703,13 @@ namespace gbe {
std::string& clName,
int& optLevel)
{
- char clStr[] = "/tmp/XXXXXX.cl";
- int clFd = mkstemps(clStr, 3);
+#if defined(__ANDROID__)
+ //Android don't have /tmp and mkstemps
+ char clStr[] = "/data/local/tmp/cl.XXXXXX";
+#else
+ char clStr[] = "/tmp/cl.XXXXXX";
+#endif
+ int clFd = mkstemp(clStr);
clName = std::string(clStr);
FILE *clFile = fdopen(clFd, "w");
--
1.8.3.2
More information about the Beignet
mailing list