View | Details | Raw Unified | Return to bug 23775
Collapse All | Expand All

(-)a/tapsets.cxx (-8 / +26 lines)
Lines 12396-12411 tracepoint_builder::init_dw(systemtap_session& s) Link Here
12396
    }
12396
    }
12397
12397
12398
  // find kernel_source_tree from a source link, when different from build
12398
  // find kernel_source_tree from a source link, when different from build
12399
  if (s.kernel_source_tree == "" && endswith(s.kernel_build_tree, "/build"))
12399
  if (s.kernel_source_tree == "")
12400
    {
12400
    {
12401
      string source_tree = s.kernel_build_tree;
12401
      vector<string> source_trees;
12402
      source_tree.replace(source_tree.length() - 5, 5, "source");
12402
12403
      if (file_exists(source_tree) &&
12403
      // vendor kernel (e.g. Fedora): the source link is in the same dir
12404
          resolve_path(source_tree) != resolve_path(s.kernel_build_tree))
12404
      // as the build tree
12405
      if (endswith(s.kernel_build_tree, "/build"))
12406
        {
12407
          string source_tree = s.kernel_build_tree;
12408
          source_tree.replace(source_tree.length() - 5, 5, "source");
12409
          source_trees.push_back(source_tree);
12410
        }
12411
12412
      // vanilla kernel: the source link is in the build tree
12413
      source_trees.push_back(s.kernel_build_tree + "/source");
12414
12415
      for (unsigned i = 0; i < source_trees.size(); i++)
12405
        {
12416
        {
12406
          if (s.verbose > 2)
12417
          string source_tree = source_trees[i];
12407
            clog << _F("Located kernel source tree at '%s'", source_tree.c_str()) << endl;
12418
12408
          s.kernel_source_tree = source_tree;
12419
          if (dir_exists(source_tree) &&
12420
              resolve_path(source_tree) != resolve_path(s.kernel_build_tree))
12421
            {
12422
              if (s.verbose > 2)
12423
                clog << _F("Located kernel source tree at '%s'", source_tree.c_str()) << endl;
12424
              s.kernel_source_tree = source_tree;
12425
              break;
12426
            }
12409
        }
12427
        }
12410
    }
12428
    }
12411
12429
(-)a/util.cxx (+13 lines)
Lines 103-108 file_exists (const string &path) Link Here
103
  return false;
103
  return false;
104
}
104
}
105
105
106
// Check that a dir is present
107
bool
108
dir_exists(const string &path)
109
{
110
  struct stat info;
111
112
  if (stat(path.c_str(), &info) == 0 &&
113
      S_ISDIR(info.st_mode))
114
    return true;
115
116
  return false;
117
}
118
106
// Copy a file.  The copy is done via a temporary file and atomic
119
// Copy a file.  The copy is done via a temporary file and atomic
107
// rename.
120
// rename.
108
bool
121
bool
(-)a/util.h (-1 / +1 lines)
Lines 72-77 const char *get_home_directory(void); Link Here
72
size_t get_file_size(const std::string &path);
72
size_t get_file_size(const std::string &path);
73
size_t get_file_size(int fd);
73
size_t get_file_size(int fd);
74
bool file_exists (const std::string &path);
74
bool file_exists (const std::string &path);
75
bool dir_exists(const std::string &path);
75
bool copy_file(const std::string& src, const std::string& dest,
76
bool copy_file(const std::string& src, const std::string& dest,
76
               bool verbose=false);
77
               bool verbose=false);
77
int create_dir(const char *dir, int mode = 0777);
78
int create_dir(const char *dir, int mode = 0777);
78
- 

Return to bug 23775