@@ -318,4 +318,5 @@ struct pid_addr_maps {
int trace_debug_get_filemap(struct pid_addr_maps **file_maps, int pid);
void trace_debug_free_filemap(struct pid_addr_maps *maps);
+int trace_read_file_string(int fd, char *dst, int len);
#endif /* __TRACE_LOCAL_H */
@@ -49,7 +49,7 @@ enum dump_items verbosity;
tracecmd_plog(fmt, ##__VA_ARGS__); \
} while (0)
-static int read_file_string(int fd, char *dst, int len)
+int trace_read_file_string(int fd, char *dst, int len)
{
size_t size = 0;
int r;
@@ -160,7 +160,7 @@ static void dump_initial_format(int fd)
die("wrong tracing string: %s", buf);
/* get file version */
- if (read_file_string(fd, buf, DUMP_SIZE))
+ if (trace_read_file_string(fd, buf, DUMP_SIZE))
die("no version string");
do_print(SUMMARY, "\t\t%s\t[Version]\n", buf);
@@ -260,7 +260,7 @@ static void dump_events_format(int fd)
while (systems) {
- if (read_file_string(fd, buf, DUMP_SIZE))
+ if (trace_read_file_string(fd, buf, DUMP_SIZE))
die("cannot read the name of the $dth system", systems);
if (read_file_number(fd, &events, 4))
die("cannot read the count of the events in system %s",
This helper function is used to read strings from a binary file locally in trace-dump.c context. The same functionality could be useful for other trace-cmd logics. Made the function non static and prefix it with "trace_", so it could be used in trace-cmd application context. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- tracecmd/include/trace-local.h | 1 + tracecmd/trace-dump.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)