diff options
Diffstat (limited to 'trace-output.c')
-rw-r--r-- | trace-output.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/trace-output.c b/trace-output.c index 89b3954..14fe0f1 100644 --- a/trace-output.c +++ b/trace-output.c | |||
@@ -521,7 +521,7 @@ static int read_ftrace_printk(struct tracecmd_output *handle) | |||
521 | } | 521 | } |
522 | 522 | ||
523 | static struct tracecmd_output * | 523 | static struct tracecmd_output * |
524 | create_file_fd(int fd, int cpus, struct tracecmd_input *ihandle) | 524 | create_file_fd(int fd, struct tracecmd_input *ihandle) |
525 | { | 525 | { |
526 | struct tracecmd_output *handle; | 526 | struct tracecmd_output *handle; |
527 | unsigned long long endian8; | 527 | unsigned long long endian8; |
@@ -629,7 +629,7 @@ create_file_fd(int fd, int cpus, struct tracecmd_input *ihandle) | |||
629 | return NULL; | 629 | return NULL; |
630 | } | 630 | } |
631 | 631 | ||
632 | static struct tracecmd_output *create_file(const char *output_file, int cpus, | 632 | static struct tracecmd_output *create_file(const char *output_file, |
633 | struct tracecmd_input *ihandle) | 633 | struct tracecmd_input *ihandle) |
634 | { | 634 | { |
635 | struct tracecmd_output *handle; | 635 | struct tracecmd_output *handle; |
@@ -639,7 +639,7 @@ static struct tracecmd_output *create_file(const char *output_file, int cpus, | |||
639 | if (fd < 0) | 639 | if (fd < 0) |
640 | return NULL; | 640 | return NULL; |
641 | 641 | ||
642 | handle = create_file_fd(fd, cpus, ihandle); | 642 | handle = create_file_fd(fd, ihandle); |
643 | if (!handle) { | 643 | if (!handle) { |
644 | close(fd); | 644 | close(fd); |
645 | unlink(output_file); | 645 | unlink(output_file); |
@@ -673,7 +673,7 @@ struct tracecmd_output *tracecmd_create_file_latency(const char *output_file, in | |||
673 | struct tracecmd_output *handle; | 673 | struct tracecmd_output *handle; |
674 | char *path; | 674 | char *path; |
675 | 675 | ||
676 | handle = create_file(output_file, cpus, NULL); | 676 | handle = create_file(output_file, NULL); |
677 | if (!handle) | 677 | if (!handle) |
678 | return NULL; | 678 | return NULL; |
679 | 679 | ||
@@ -705,9 +705,9 @@ out_free: | |||
705 | int tracecmd_append_cpu_data(struct tracecmd_output *handle, | 705 | int tracecmd_append_cpu_data(struct tracecmd_output *handle, |
706 | int cpus, char * const *cpu_data_files) | 706 | int cpus, char * const *cpu_data_files) |
707 | { | 707 | { |
708 | unsigned long long *offsets = NULL; | 708 | off64_t *offsets = NULL; |
709 | unsigned long long *sizes = NULL; | 709 | unsigned long long *sizes = NULL; |
710 | unsigned long long offset; | 710 | off64_t offset; |
711 | unsigned long long endian8; | 711 | unsigned long long endian8; |
712 | off64_t check_size; | 712 | off64_t check_size; |
713 | char *file; | 713 | char *file; |
@@ -733,7 +733,7 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle, | |||
733 | if (!sizes) | 733 | if (!sizes) |
734 | goto out_free; | 734 | goto out_free; |
735 | 735 | ||
736 | offset = lseek(handle->fd, 0, SEEK_CUR); | 736 | offset = lseek64(handle->fd, 0, SEEK_CUR); |
737 | 737 | ||
738 | /* hold any extra data for data */ | 738 | /* hold any extra data for data */ |
739 | offset += cpus * (16); | 739 | offset += cpus * (16); |
@@ -761,8 +761,8 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle, | |||
761 | 761 | ||
762 | for (i = 0; i < cpus; i++) { | 762 | for (i = 0; i < cpus; i++) { |
763 | fprintf(stderr, "offset=%llx\n", offsets[i]); | 763 | fprintf(stderr, "offset=%llx\n", offsets[i]); |
764 | ret = lseek64(handle->fd, offsets[i], SEEK_SET); | 764 | offset = lseek64(handle->fd, offsets[i], SEEK_SET); |
765 | if (ret < 0) { | 765 | if (offset == (off64_t)-1) { |
766 | warning("could not seek to %lld\n", offsets[i]); | 766 | warning("could not seek to %lld\n", offsets[i]); |
767 | goto out_free; | 767 | goto out_free; |
768 | } | 768 | } |
@@ -850,7 +850,7 @@ struct tracecmd_output *tracecmd_create_file(const char *output_file, | |||
850 | { | 850 | { |
851 | struct tracecmd_output *handle; | 851 | struct tracecmd_output *handle; |
852 | 852 | ||
853 | handle = create_file(output_file, cpus, NULL); | 853 | handle = create_file(output_file, NULL); |
854 | if (!handle) | 854 | if (!handle) |
855 | return NULL; | 855 | return NULL; |
856 | 856 | ||
@@ -860,16 +860,14 @@ struct tracecmd_output *tracecmd_create_file(const char *output_file, | |||
860 | return handle; | 860 | return handle; |
861 | } | 861 | } |
862 | 862 | ||
863 | struct tracecmd_output * | 863 | struct tracecmd_output *tracecmd_create_init_fd(int fd) |
864 | tracecmd_create_init_fd(int fd, int cpus) | ||
865 | { | 864 | { |
866 | struct tracecmd_output *handle; | 865 | return create_file_fd(fd, NULL); |
867 | 866 | } | |
868 | handle = create_file_fd(fd, cpus, NULL); | ||
869 | if (!handle) | ||
870 | return NULL; | ||
871 | 867 | ||
872 | return handle; | 868 | struct tracecmd_output *tracecmd_create_init_file(const char *output_file) |
869 | { | ||
870 | return create_file(output_file, NULL); | ||
873 | } | 871 | } |
874 | 872 | ||
875 | /** | 873 | /** |
@@ -886,7 +884,7 @@ struct tracecmd_output *tracecmd_copy(struct tracecmd_input *ihandle, | |||
886 | { | 884 | { |
887 | struct tracecmd_output *handle; | 885 | struct tracecmd_output *handle; |
888 | 886 | ||
889 | handle = create_file(file, tracecmd_cpus(ihandle), ihandle); | 887 | handle = create_file(file, ihandle); |
890 | if (!handle) | 888 | if (!handle) |
891 | return NULL; | 889 | return NULL; |
892 | 890 | ||