aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
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 /lib/hipe
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
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/llvm/hipe_llvm_main.erl12
1 files changed, 10 insertions, 2 deletions
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) ->