aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-10-25 19:17:36 +0200
committerGitHub <[email protected]>2018-10-25 19:17:36 +0200
commitdd8ed8ee81cd8995af32543f76256aa6922b4a6f (patch)
treee1efa21161cee1039aa187fd825c77b000563a51
parentabfb3940842523eefec77b9e44979a328c5350e7 (diff)
parentd0ee664621f485b533a26805c21c8058ad59a6b7 (diff)
downloadotp-dd8ed8ee81cd8995af32543f76256aa6922b4a6f.tar.gz
otp-dd8ed8ee81cd8995af32543f76256aa6922b4a6f.tar.bz2
otp-dd8ed8ee81cd8995af32543f76256aa6922b4a6f.zip
Merge PR-1963 from iblis17/ib/fbsd-hipe OTP-15386
hipe_llvm_main: fix tmpfs dir on FreeBSD
-rw-r--r--.gitignore1
-rw-r--r--lib/hipe/llvm/hipe_llvm_main.erl12
2 files changed, 11 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 3e7013ee6b..02894c4786 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ i686-pc-linux-gnu
x86_64-unknown-linux-gnu
i386-apple-darwin[0-9]*.[0-9]*.[0-9]*
x86_64-apple-darwin[0-9]*.[0-9]*.[0-9]*
+x86_64-unknown-freebsd[0-9]*.[0-9]*
sparc-sun-solaris[0-9]*.[0-9]*
i386-pc-solaris[0-9]*.[0-9]*
i386-unknown-freebsd[0-9]*.[0-9]*
diff --git a/lib/hipe/llvm/hipe_llvm_main.erl b/lib/hipe/llvm/hipe_llvm_main.erl
index 54c435c127..44f0566379 100644
--- a/lib/hipe/llvm/hipe_llvm_main.erl
+++ b/lib/hipe/llvm/hipe_llvm_main.erl
@@ -526,8 +526,8 @@ unique_folder(FunName, Arity, Options) ->
case proplists:get_bool(llvm_save_temps, Options) of
true -> %% Store folder in current directory
DirName;
- false -> %% Temporarily store folder in tempfs (/dev/shm/)
- "/dev/shm/" ++ DirName
+ false -> %% Temporarily store folder in tempfs or tmp dir
+ tmpfs_folder() ++ DirName
end,
%% Make sure it does not exist
case dir_exists(Dir) of
@@ -537,6 +537,14 @@ unique_folder(FunName, Arity, Options) ->
Dir
end.
+tmpfs_folder() ->
+ case os:type() of
+ {unix, linux} ->
+ "/dev/shm/";
+ {unix, _} -> %% Fallback to tmp dir. e.g. FreeBSD
+ "/tmp/"
+ end.
+
%% @doc Function that checks that a given Filename is an existing Directory
%% Name (from http://rosettacode.org/wiki/Ensure_that_a_file_exists#Erlang)
dir_exists(Filename) ->