aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--.gitignore1
-rw-r--r--lib/hipe/llvm/hipe_llvm_main.erl10
2 files changed, 10 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index fee8cba0c7..59c80358f1 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..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) ->