aboutsummaryrefslogtreecommitdiffstats
path: root/trace-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-input.c')
-rw-r--r--trace-input.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/trace-input.c b/trace-input.c
index 80de3cf..ee9177f 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -1316,10 +1316,10 @@ void tracecmd_print_events(struct tracecmd_input *handle)
1316} 1316}
1317 1317
1318/** 1318/**
1319 * tracecmd_open - create a tracecmd_handle from the trace.dat file descriptor 1319 * tracecmd_open_fd - create a tracecmd_handle from the trace.dat file descriptor
1320 * @fd: the file descriptor for the trace.dat file 1320 * @fd: the file descriptor for the trace.dat file
1321 */ 1321 */
1322struct tracecmd_input *tracecmd_open(int fd) 1322struct tracecmd_input *tracecmd_open_fd(int fd)
1323{ 1323{
1324 struct tracecmd_input *handle; 1324 struct tracecmd_input *handle;
1325 char test[] = { 23, 8, 68 }; 1325 char test[] = { 23, 8, 68 };
@@ -1377,6 +1377,28 @@ struct tracecmd_input *tracecmd_open(int fd)
1377} 1377}
1378 1378
1379/** 1379/**
1380 * tracecmd_open - create a tracecmd_handle from a given file
1381 * @file: the file name of the file that is of tracecmd data type.
1382 */
1383struct tracecmd_input *tracecmd_open(const char *file)
1384{
1385 int fd;
1386
1387 fd = open(file, O_RDONLY);
1388 if (fd < 0)
1389 return NULL;
1390
1391 return tracecmd_open_fd(fd);
1392}
1393
1394void tracecmd_close(struct tracecmd_input *handle)
1395{
1396 /* TODO FREE EVERYTHING!!! %%%% MEMORY LEAK!!! %%%% */
1397 close(handle->fd);
1398 free(handle);
1399}
1400
1401/**
1380 * tracecmd_long_size - return the size of "long" for the arch 1402 * tracecmd_long_size - return the size of "long" for the arch
1381 * @handle: input handle for the trace.dat file 1403 * @handle: input handle for the trace.dat file
1382 */ 1404 */