diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-11 16:22:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-11 16:22:43 -0400 |
commit | 4f0ac854167846bd55cd81dbc9a36e03708aa01c (patch) | |
tree | 0eb34d18a667f8e68ad9255f791560b028fed2a6 /tools/perf/util/path.c | |
parent | b9356c53ba2f593081e5aa45eb67adcce243d1c0 (diff) | |
parent | 6b58e7f146f8d79c08f62087f928e1f01747de71 (diff) |
Merge branch 'perfcounters-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perfcounters-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (60 commits)
perf tools: Avoid unnecessary work in directory lookups
perf stat: Clean up statistics calculations a bit more
perf stat: More advanced variance computation
perf stat: Use stddev_mean in stead of stddev
perf stat: Remove the limit on repeat
perf stat: Change noise calculation to use stddev
x86, perf_counter, bts: Do not allow kernel BTS tracing for now
x86, perf_counter, bts: Correct pointer-to-u64 casts
x86, perf_counter, bts: Fail if BTS is not available
perf_counter: Fix output-sharing error path
perf trace: Fix read_string()
perf trace: Print out in nanoseconds
perf tools: Seek to the end of the header area
perf trace: Fix parsing of perf.data
perf trace: Sample timestamps as well
perf_counter: Introduce new (non-)paranoia level to allow raw tracepoint access
perf trace: Sample the CPU too
perf tools: Work around strict aliasing related warnings
perf tools: Clean up warnings list in the Makefile
perf tools: Complete support for dynamic strings
...
Diffstat (limited to 'tools/perf/util/path.c')
-rw-r--r-- | tools/perf/util/path.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c index a501a40dd2cb..fd1f2faaade4 100644 --- a/tools/perf/util/path.c +++ b/tools/perf/util/path.c | |||
@@ -17,7 +17,7 @@ static char bad_path[] = "/bad-path/"; | |||
17 | * Two hacks: | 17 | * Two hacks: |
18 | */ | 18 | */ |
19 | 19 | ||
20 | static char *get_perf_dir(void) | 20 | static const char *get_perf_dir(void) |
21 | { | 21 | { |
22 | return "."; | 22 | return "."; |
23 | } | 23 | } |
@@ -38,8 +38,9 @@ size_t strlcpy(char *dest, const char *src, size_t size) | |||
38 | static char *get_pathname(void) | 38 | static char *get_pathname(void) |
39 | { | 39 | { |
40 | static char pathname_array[4][PATH_MAX]; | 40 | static char pathname_array[4][PATH_MAX]; |
41 | static int index; | 41 | static int idx; |
42 | return pathname_array[3 & ++index]; | 42 | |
43 | return pathname_array[3 & ++idx]; | ||
43 | } | 44 | } |
44 | 45 | ||
45 | static char *cleanup_path(char *path) | 46 | static char *cleanup_path(char *path) |
@@ -161,20 +162,24 @@ int perf_mkstemp(char *path, size_t len, const char *template) | |||
161 | } | 162 | } |
162 | 163 | ||
163 | 164 | ||
164 | const char *make_relative_path(const char *abs, const char *base) | 165 | const char *make_relative_path(const char *abs_path, const char *base) |
165 | { | 166 | { |
166 | static char buf[PATH_MAX + 1]; | 167 | static char buf[PATH_MAX + 1]; |
167 | int baselen; | 168 | int baselen; |
169 | |||
168 | if (!base) | 170 | if (!base) |
169 | return abs; | 171 | return abs_path; |
172 | |||
170 | baselen = strlen(base); | 173 | baselen = strlen(base); |
171 | if (prefixcmp(abs, base)) | 174 | if (prefixcmp(abs_path, base)) |
172 | return abs; | 175 | return abs_path; |
173 | if (abs[baselen] == '/') | 176 | if (abs_path[baselen] == '/') |
174 | baselen++; | 177 | baselen++; |
175 | else if (base[baselen - 1] != '/') | 178 | else if (base[baselen - 1] != '/') |
176 | return abs; | 179 | return abs_path; |
177 | strcpy(buf, abs + baselen); | 180 | |
181 | strcpy(buf, abs_path + baselen); | ||
182 | |||
178 | return buf; | 183 | return buf; |
179 | } | 184 | } |
180 | 185 | ||