From 3d054bfa6ce74a11107b8b276426bcc498cadd56 Mon Sep 17 00:00:00 2001 From: Iblis Lin Date: Wed, 26 Sep 2018 10:33:03 +0800 Subject: 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 --- lib/hipe/llvm/hipe_llvm_main.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/hipe') 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) -> -- cgit v1.2.3