Home | History | Annotate | Line # | Download | only in profile
      1  1.1  joerg /*===- InstrProfilingUtil.c - Support library for PGO instrumentation -----===*\
      2  1.1  joerg |*
      3  1.1  joerg |*                     The LLVM Compiler Infrastructure
      4  1.1  joerg |*
      5  1.1  joerg |* This file is distributed under the University of Illinois Open Source
      6  1.1  joerg |* License. See LICENSE.TXT for details.
      7  1.1  joerg |*
      8  1.1  joerg \*===----------------------------------------------------------------------===*/
      9  1.1  joerg 
     10  1.1  joerg #include "InstrProfilingUtil.h"
     11  1.1  joerg #include "InstrProfiling.h"
     12  1.1  joerg 
     13  1.1  joerg #ifdef _WIN32
     14  1.1  joerg #include <direct.h>
     15  1.1  joerg #elif I386_FREEBSD
     16  1.1  joerg int mkdir(const char*, unsigned short);
     17  1.1  joerg #else
     18  1.1  joerg #include <sys/stat.h>
     19  1.1  joerg #include <sys/types.h>
     20  1.1  joerg #endif
     21  1.1  joerg 
     22  1.1  joerg COMPILER_RT_VISIBILITY
     23  1.1  joerg void __llvm_profile_recursive_mkdir(char *path) {
     24  1.1  joerg   int i;
     25  1.1  joerg 
     26  1.1  joerg   for (i = 1; path[i] != '\0'; ++i) {
     27  1.1  joerg     if (path[i] != '/') continue;
     28  1.1  joerg     path[i] = '\0';
     29  1.1  joerg #ifdef _WIN32
     30  1.1  joerg     _mkdir(path);
     31  1.1  joerg #else
     32  1.1  joerg     mkdir(path, 0755);  /* Some of these will fail, ignore it. */
     33  1.1  joerg #endif
     34  1.1  joerg     path[i] = '/';
     35  1.1  joerg   }
     36  1.1  joerg }
     37