summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/profile/InstrProfilingUtil.c
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-03-06 04:52:45 +0000
committerXinliang David Li <davidxl@google.com>2016-03-06 04:52:45 +0000
commit44fd38856c43dc5b188fcaefc1c2611ac0a4d5cd (patch)
tree57cf5d63ec5b754187d5e81a657e64d2ef03e307 /compiler-rt/lib/profile/InstrProfilingUtil.c
parent11bf1ac297d134bda18ac883fdc20a6f95bfe5c7 (diff)
downloadbcm5719-llvm-44fd38856c43dc5b188fcaefc1c2611ac0a4d5cd.tar.gz
bcm5719-llvm-44fd38856c43dc5b188fcaefc1c2611ac0a4d5cd.zip
[PGO] cleanup: move one support method into InstrProfilingUtil.h /NFC
llvm-svn: 262791
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfilingUtil.c')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingUtil.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c
index 59b17511ca3..d51d9f02ea7 100644
--- a/compiler-rt/lib/profile/InstrProfilingUtil.c
+++ b/compiler-rt/lib/profile/InstrProfilingUtil.c
@@ -19,6 +19,12 @@ int mkdir(const char*, unsigned short);
#include <sys/types.h>
#endif
+#ifdef COMPILER_RT_HAS_UNAME
+#include <sys/utsname.h>
+#endif
+
+#include <string.h>
+
COMPILER_RT_VISIBILITY
void __llvm_profile_recursive_mkdir(char *path) {
int i;
@@ -47,3 +53,14 @@ uint32_t lprofBoolCmpXchg(void **Ptr, void *OldV, void *NewV) {
}
#endif
+#ifdef COMPILER_RT_HAS_UNAME
+int lprofGetHostName(char *Name, int Len) {
+ struct utsname N;
+ int R;
+ if (!(R = uname(&N)))
+ strncpy(Name, N.nodename, Len);
+ return R;
+}
+#endif
+
+
OpenPOWER on IntegriCloud