aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/llvm
diff options
context:
space:
mode:
authorIblis Lin <[email protected]>2018-09-26 10:33:03 +0800
committerIblis Lin <[email protected]>2018-09-26 10:33:03 +0800
commit3d054bfa6ce74a11107b8b276426bcc498cadd56 (patch)
tree734cb05ae5868577f4010421c6d99471d56111bb /lib/hipe/llvm
parent1d5d8a8c5c7cc8f0e011bb121ef21787ece2be58 (diff)
downloadotp-3d054bfa6ce74a11107b8b276426bcc498cadd56.tar.gz
otp-3d054bfa6ce74a11107b8b276426bcc498cadd56.tar.bz2
otp-3d054bfa6ce74a11107b8b276426bcc498cadd56.zip
hipe_llvm_main: fix tmpfs dir on FreeBSD
Upstream this patch from FreeBSD Ports: https://svnweb.freebsd.org/ports/head/lang/erlang-runtime21/files/patch-lib_hipe_llvm_hipe__llvm__main.erl?revision=473434&view=markup
Diffstat (limited to 'lib/hipe/llvm')
-rw-r--r--lib/hipe/llvm/hipe_llvm_main.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/hipe/llvm/hipe_llvm_main.erl b/lib/hipe/llvm/hipe_llvm_main.erl
index 54c435c127..1d7a51b5b1 100644
--- a/lib/hipe/llvm/hipe_llvm_main.erl
+++ b/lib/hipe/llvm/hipe_llvm_main.erl
@@ -527,7 +527,7 @@ unique_folder(FunName, Arity, Options) ->
true -> %% Store folder in current directory
DirName;
false -> %% Temporarily store folder in tempfs (/dev/shm/)
- "/dev/shm/" ++ DirName
+ 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) ->