aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-kernel/trace-cmd/files/0001-Replace-LFS64-interfaces-off64_t-and-lseek64.patch
blob: 1e5415ef6a4724d07b76f7089623d7c63bc68361 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
From 9c3213a3b64e049c1aa065300b01ee751699b01f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 6 Jan 2023 16:53:06 -0800
Subject: [PATCH 1/2] Replace LFS64 interfaces off64_t and lseek64

Musl does not define these interfaces unless -D_LARGEFILE64_SOURCE is
defined and that too it is transitional until apps switch to using 64-bit
off_t. We pass -D_FILE_OFFSET_BITS=64 in makefiles already therefore
original lseek and off_t are already 64bit

This fixes build with latest musl which has dropped LFS64 interfaces [1]

[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4i

Upstream-Status: Submitted [https://lore.kernel.org/linux-trace-devel/20230109225315.1284538-1-raj.khem@gmail.com/]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../include/private/trace-cmd-private.h       |  12 +-
 lib/trace-cmd/include/trace-cmd-local.h       |   4 +-
 lib/trace-cmd/trace-compress.c                |  30 ++---
 lib/trace-cmd/trace-input.c                   | 110 +++++++++---------
 lib/trace-cmd/trace-msg.c                     |  20 ++--
 lib/trace-cmd/trace-output.c                  |  64 +++++-----
 lib/trace-cmd/trace-recorder.c                |   8 +-
 tracecmd/trace-dump.c                         |  34 +++---
 tracecmd/trace-read.c                         |   2 +-
 9 files changed, 142 insertions(+), 142 deletions(-)

diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
index 05c084ce..f2cf8dc8 100644
--- a/lib/trace-cmd/include/private/trace-cmd-private.h
+++ b/lib/trace-cmd/include/private/trace-cmd-private.h
@@ -106,7 +106,7 @@ const char *tracecmd_get_trace_clock(struct tracecmd_input *handle);
 const char *tracecmd_get_cpustats(struct tracecmd_input *handle);
 const char *tracecmd_get_uname(struct tracecmd_input *handle);
 const char *tracecmd_get_version(struct tracecmd_input *handle);
-off64_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu);
+off_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu);
 
 static inline int tracecmd_host_bigendian(void)
 {
@@ -336,7 +336,7 @@ int tracecmd_write_buffer_info(struct tracecmd_output *handle);
 
 int tracecmd_write_cpus(struct tracecmd_output *handle, int cpus);
 int tracecmd_write_cmdlines(struct tracecmd_output *handle);
-int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int whence);
+int tracecmd_prepare_options(struct tracecmd_output *handle, off_t offset, int whence);
 int tracecmd_write_options(struct tracecmd_output *handle);
 int tracecmd_write_meta_strings(struct tracecmd_output *handle);
 int tracecmd_append_options(struct tracecmd_output *handle);
@@ -394,7 +394,7 @@ struct tracecmd_msg_handle {
 	short			cpu_count;
 	short			version;	/* Current protocol version */
 	unsigned long		flags;
-	off64_t			cache_start_offset;
+	off_t			cache_start_offset;
 	bool			done;
 	bool			cache;
 	int			cfd;
@@ -543,8 +543,8 @@ int tracecmd_write_guest_time_shift(struct tracecmd_output *handle,
 struct tracecmd_compress_chunk {
 	unsigned int		size;
 	unsigned int		zsize;
-	off64_t			zoffset;
-	off64_t			offset;
+	off_t			zoffset;
+	off_t			offset;
 };
 struct tracecmd_compression;
 struct tracecmd_compression_proto {
@@ -570,7 +570,7 @@ int tracecmd_compress_buffer_read(struct tracecmd_compression *handle, char *dst
 int tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, int len, off_t offset);
 int tracecmd_compress_buffer_write(struct tracecmd_compression *handle,
 				   const void *data, unsigned long long size);
-off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t offset, int whence);
+off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset, int whence);
 int tracecmd_compress_proto_get_name(struct tracecmd_compression *compress,
 				     const char **name, const char **version);
 bool tracecmd_compress_is_supported(const char *name, const char *version);
diff --git a/lib/trace-cmd/include/trace-cmd-local.h b/lib/trace-cmd/include/trace-cmd-local.h
index db0b2c21..ebd6f152 100644
--- a/lib/trace-cmd/include/trace-cmd-local.h
+++ b/lib/trace-cmd/include/trace-cmd-local.h
@@ -94,13 +94,13 @@ out_add_buffer_option(struct tracecmd_output *handle, const char *name,
 struct cpu_data_source {
 	int fd;
 	int size;
-	off64_t offset;
+	off_t offset;
 };
 
 int out_write_cpu_data(struct tracecmd_output *handle, int cpus,
 		       struct cpu_data_source *data, const char *buff_name);
 int out_write_emty_cpu_data(struct tracecmd_output *handle, int cpus);
-off64_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off64_t offset, int whence);
+off_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off_t offset, int whence);
 unsigned long long get_last_option_offset(struct tracecmd_input *handle);
 unsigned int get_meta_strings_size(struct tracecmd_input *handle);
 int trace_append_options(struct tracecmd_output *handle, void *buf, size_t len);
diff --git a/lib/trace-cmd/trace-compress.c b/lib/trace-cmd/trace-compress.c
index 461de8d0..1b852f18 100644
--- a/lib/trace-cmd/trace-compress.c
+++ b/lib/trace-cmd/trace-compress.c
@@ -117,12 +117,12 @@ static inline int buffer_extend(struct tracecmd_compression *handle, unsigned in
  *
  * Returns the new file pointer on success, or -1 in case of an error.
  */
-off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t offset, int whence)
+off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset, int whence)
 {
 	unsigned long p;
 
 	if (!handle || !handle->buffer)
-		return (off64_t)-1;
+		return (off_t)-1;
 
 	switch (whence) {
 	case SEEK_CUR:
@@ -135,11 +135,11 @@ off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t off
 		p = offset;
 		break;
 	default:
-		return (off64_t)-1;
+		return (off_t)-1;
 	}
 
 	if (buffer_extend(handle, p))
-		return (off64_t)-1;
+		return (off_t)-1;
 
 	handle->pointer = p;
 
@@ -678,7 +678,7 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int
 	unsigned int size;
 	unsigned int all;
 	unsigned int r;
-	off64_t offset;
+	off_t offset;
 	char *buf_from;
 	char *buf_to;
 	int endian4;
@@ -700,7 +700,7 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int
 		return -1;
 
 	/* save the initial offset and write 0 as initial chunk count */
-	offset = lseek64(handle->fd, 0, SEEK_CUR);
+	offset = lseek(handle->fd, 0, SEEK_CUR);
 	write_fd(handle->fd, &chunks, 4);
 
 	do {
@@ -760,13 +760,13 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int
 	if (all)
 		return -1;
 
-	if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	endian4 = tep_read_number(handle->tep, &chunks, 4);
 	/* write chunks count*/
 	write_fd(handle->fd, &chunks, 4);
-	if (lseek64(handle->fd, 0, SEEK_END) == (off_t)-1)
+	if (lseek(handle->fd, 0, SEEK_END) == (off_t)-1)
 		return -1;
 
 	if (read_size)
@@ -796,7 +796,7 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
 	struct tracecmd_compress_chunk *chunks = NULL;
 	unsigned long long size = 0;
 	unsigned int count = 0;
-	off64_t offset;
+	off_t offset;
 	int ret = -1;
 	char buf[4];
 	int i;
@@ -804,8 +804,8 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
 	if (!handle)
 		return -1;
 
-	offset = lseek64(handle->fd, 0, SEEK_CUR);
-	if (offset == (off64_t)-1)
+	offset = lseek(handle->fd, 0, SEEK_CUR);
+	if (offset == (off_t)-1)
 		return -1;
 
 	if (read(handle->fd, buf, 4) != 4)
@@ -822,7 +822,7 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
 		goto out;
 
 	for (i = 0; i < count; i++) {
-		chunks[i].zoffset = lseek64(handle->fd, 0, SEEK_CUR);
+		chunks[i].zoffset = lseek(handle->fd, 0, SEEK_CUR);
 		if (chunks[i].zoffset == (off_t)-1)
 			goto out;
 		if (read(handle->fd, buf, 4) != 4)
@@ -833,13 +833,13 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
 			goto out;
 		chunks[i].size = tep_read_number(handle->tep, buf, 4);
 		size += chunks[i].size;
-		if (lseek64(handle->fd, chunks[i].zsize, SEEK_CUR) == (off64_t)-1)
+		if (lseek(handle->fd, chunks[i].zsize, SEEK_CUR) == (off_t)-1)
 			goto out;
 	}
 
 	ret = count;
 out:
-	if (lseek64(handle->fd, offset, SEEK_SET) == (off64_t)-1)
+	if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
 		ret = -1;
 
 	if (ret > 0 && chunks_info)
@@ -872,7 +872,7 @@ int tracecmd_uncompress_chunk(struct tracecmd_compression *handle,
 	if (!handle || !handle->proto || !handle->proto->uncompress_block || !chunk || !data)
 		return -1;
 
-	if (lseek64(handle->fd, chunk->zoffset + 8, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, chunk->zoffset + 8, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	bytes_in = malloc(chunk->zsize);
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 594eb74a..9b128403 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -37,8 +37,8 @@ static int force_read = 0;
 
 struct page_map {
 	struct list_head	list;
-	off64_t			offset;
-	off64_t			size;
+	off_t			offset;
+	off_t			size;
 	void			*map;
 	int			ref_count;
 };
@@ -54,7 +54,7 @@ struct follow_event {
 
 struct page {
 	struct list_head	list;
-	off64_t			offset;
+	off_t			offset;
 	struct tracecmd_input	*handle;
 	struct page_map		*page_map;
 	void			*map;
@@ -541,7 +541,7 @@ static struct file_section *section_open(struct tracecmd_input *handle, int id)
 	if (!sec)
 		return NULL;
 
-	if (lseek64(handle->fd, sec->data_offset, SEEK_SET) == (off64_t)-1)
+	if (lseek(handle->fd, sec->data_offset, SEEK_SET) == (off_t)-1)
 		return NULL;
 
 	if ((sec->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle))
@@ -593,7 +593,7 @@ static int read_header_files(struct tracecmd_input *handle)
 
 	if (!HAS_SECTIONS(handle))
 		section_add_or_update(handle, TRACECMD_OPTION_HEADER_INFO, 0, 0,
-				      lseek64(handle->fd, 0, SEEK_CUR));
+				      lseek(handle->fd, 0, SEEK_CUR));
 
 	if (do_read_check(handle, buf, 12))
 		return -1;
@@ -800,7 +800,7 @@ static int read_ftrace_files(struct tracecmd_input *handle, const char *regex)
 
 	if (!HAS_SECTIONS(handle))
 		section_add_or_update(handle, TRACECMD_OPTION_FTRACE_EVENTS, 0, 0,
-				      lseek64(handle->fd, 0, SEEK_CUR));
+				      lseek(handle->fd, 0, SEEK_CUR));
 
 	if (regex) {
 		sreg = &spreg;
@@ -875,7 +875,7 @@ static int read_event_files(struct tracecmd_input *handle, const char *regex)
 
 	if (!HAS_SECTIONS(handle))
 		section_add_or_update(handle, TRACECMD_OPTION_EVENT_FORMATS, 0, 0,
-				      lseek64(handle->fd, 0, SEEK_CUR));
+				      lseek(handle->fd, 0, SEEK_CUR));
 
 	if (regex) {
 		sreg = &spreg;
@@ -962,7 +962,7 @@ static int read_proc_kallsyms(struct tracecmd_input *handle)
 		return 0;
 	if (!HAS_SECTIONS(handle))
 		section_add_or_update(handle, TRACECMD_OPTION_KALLSYMS, 0, 0,
-				      lseek64(handle->fd, 0, SEEK_CUR));
+				      lseek(handle->fd, 0, SEEK_CUR));
 
 	if (read4(handle, &size) < 0)
 		return -1;
@@ -999,7 +999,7 @@ static int read_ftrace_printk(struct tracecmd_input *handle)
 
 	if (!HAS_SECTIONS(handle))
 		section_add_or_update(handle, TRACECMD_OPTION_PRINTK, 0, 0,
-				      lseek64(handle->fd, 0, SEEK_CUR));
+				      lseek(handle->fd, 0, SEEK_CUR));
 
 	if (read4(handle, &size) < 0)
 		return -1;
@@ -1173,7 +1173,7 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se
 	unsigned long long size;
 	int ret;
 
-	if (lseek64(handle->fd, section->section_offset, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, section->section_offset, SEEK_SET) == (off_t)-1)
 		return -1;
 	if (read_section_header(handle, &id, &flags, &size, NULL))
 		return -1;
@@ -1181,7 +1181,7 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se
 	if (id != section->id)
 		return -1;
 
-	section->data_offset = lseek64(handle->fd, 0, SEEK_CUR);
+	section->data_offset = lseek(handle->fd, 0, SEEK_CUR);
 	if ((section->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle))
 		return -1;
 
@@ -1225,7 +1225,7 @@ static int read_headers(struct tracecmd_input *handle, const char *regex)
 	if (!handle->options_start)
 		return -1;
 
-	if (lseek64(handle->fd, handle->options_start, SEEK_SET) == (off64_t)-1) {
+	if (lseek(handle->fd, handle->options_start, SEEK_SET) == (off_t)-1) {
 		tracecmd_warning("Filed to goto options offset %lld", handle->options_start);
 		return -1;
 	}
@@ -1269,11 +1269,11 @@ static unsigned long long calc_page_offset(struct tracecmd_input *handle,
 	return offset & ~(handle->page_size - 1);
 }
 
-static int read_page(struct tracecmd_input *handle, off64_t offset,
+static int read_page(struct tracecmd_input *handle, off_t offset,
 		     int cpu, void *map)
 {
-	off64_t save_seek;
-	off64_t ret;
+	off_t save_seek;
+	off_t ret;
 
 	if (handle->use_pipe) {
 		ret = read(handle->cpu_data[cpu].pipe_fd, map, handle->page_size);
@@ -1291,9 +1291,9 @@ static int read_page(struct tracecmd_input *handle, off64_t offset,
 	}
 
 	/* other parts of the code may expect the pointer to not move */
-	save_seek = lseek64(handle->fd, 0, SEEK_CUR);
+	save_seek = lseek(handle->fd, 0, SEEK_CUR);
 
-	ret = lseek64(handle->fd, offset, SEEK_SET);
+	ret = lseek(handle->fd, offset, SEEK_SET);
 	if (ret < 0)
 		return -1;
 	ret = read(handle->fd, map, handle->page_size);
@@ -1301,7 +1301,7 @@ static int read_page(struct tracecmd_input *handle, off64_t offset,
 		return -1;
 
 	/* reset the file pointer back */
-	lseek64(handle->fd, save_seek, SEEK_SET);
+	lseek(handle->fd, save_seek, SEEK_SET);
 
 	return 0;
 }
@@ -1348,7 +1348,7 @@ static int chunk_cmp(const void *A, const void *B)
 	return 1;
 }
 
-static struct tracecmd_compress_chunk *get_zchunk(struct cpu_data *cpu, off64_t offset)
+static struct tracecmd_compress_chunk *get_zchunk(struct cpu_data *cpu, off_t offset)
 {
 	struct cpu_zdata *cpuz = &cpu->compress;
 	struct tracecmd_compress_chunk *chunk;
@@ -1398,7 +1398,7 @@ found:
 	free(cache);
 }
 
-static void *read_zpage(struct tracecmd_input *handle, int cpu, off64_t offset)
+static void *read_zpage(struct tracecmd_input *handle, int cpu, off_t offset)
 {
 	struct cpu_data *cpu_data = &handle->cpu_data[cpu];
 	struct tracecmd_compress_chunk *chunk;
@@ -1448,12 +1448,12 @@ error:
 }
 
 static void *allocate_page_map(struct tracecmd_input *handle,
-			       struct page *page, int cpu, off64_t offset)
+			       struct page *page, int cpu, off_t offset)
 {
 	struct cpu_data *cpu_data = &handle->cpu_data[cpu];
 	struct page_map *page_map;
-	off64_t map_size;
-	off64_t map_offset;
+	off_t map_size;
+	off_t map_offset;
 	void *map;
 	int ret;
 	int fd;
@@ -1544,7 +1544,7 @@ static void *allocate_page_map(struct tracecmd_input *handle,
 }
 
 static struct page *allocate_page(struct tracecmd_input *handle,
-				  int cpu, off64_t offset)
+				  int cpu, off_t offset)
 {
 	struct cpu_data *cpu_data = &handle->cpu_data[cpu];
 	struct page **pages;
@@ -1851,7 +1851,7 @@ static int update_page_info(struct tracecmd_input *handle, int cpu)
  *        -1 on error
  */
 static int get_page(struct tracecmd_input *handle, int cpu,
-		    off64_t offset)
+		    off_t offset)
 {
 	/* Don't map if the page is already where we want */
 	if (handle->cpu_data[cpu].offset == offset &&
@@ -1895,7 +1895,7 @@ static int get_page(struct tracecmd_input *handle, int cpu,
 
 static int get_next_page(struct tracecmd_input *handle, int cpu)
 {
-	off64_t offset;
+	off_t offset;
 
 	if (!handle->cpu_data[cpu].page && !handle->use_pipe)
 		return 0;
@@ -2122,7 +2122,7 @@ struct tep_record *
 tracecmd_read_cpu_last(struct tracecmd_input *handle, int cpu)
 {
 	struct tep_record *record = NULL;
-	off64_t offset, page_offset;
+	off_t offset, page_offset;
 
 	offset = handle->cpu_data[cpu].file_offset +
 		handle->cpu_data[cpu].file_size;
@@ -2183,7 +2183,7 @@ tracecmd_set_cpu_to_timestamp(struct tracecmd_input *handle, int cpu,
 			      unsigned long long ts)
 {
 	struct cpu_data *cpu_data = &handle->cpu_data[cpu];
-	off64_t start, end, next;
+	off_t start, end, next;
 
 	if (cpu < 0 || cpu >= handle->cpus) {
 		errno = -EINVAL;
@@ -3064,11 +3064,11 @@ static int init_cpu_zfile(struct tracecmd_input *handle, int cpu)
 {
 	struct cpu_data *cpu_data;
 	unsigned long long size;
-	off64_t offset;
+	off_t offset;
 
 	cpu_data = &handle->cpu_data[cpu];
-	offset = lseek64(handle->fd, 0, SEEK_CUR);
-	if (lseek64(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
+	offset = lseek(handle->fd, 0, SEEK_CUR);
+	if (lseek(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	strcpy(cpu_data->compress.file, COMPR_TEMP_FILE);
@@ -3079,7 +3079,7 @@ static int init_cpu_zfile(struct tracecmd_input *handle, int cpu)
 	if (tracecmd_uncompress_copy_to(handle->compress, cpu_data->compress.fd, NULL, &size))
 		return -1;
 
-	if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	cpu_data->file_offset = handle->next_offset;
@@ -3098,7 +3098,7 @@ static int init_cpu_zpage(struct tracecmd_input *handle, int cpu)
 	int count;
 	int i;
 
-	if (lseek64(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	count = tracecmd_load_chunks_info(handle->compress, &cpu_data->compress.chunks);
@@ -3576,7 +3576,7 @@ static int handle_option_done(struct tracecmd_input *handle, char *buf, int size
 	if (size < 8)
 		return -1;
 
-	offset = lseek64(handle->fd, 0, SEEK_CUR);
+	offset = lseek(handle->fd, 0, SEEK_CUR);
 	if (offset >= size)
 		handle->options_last_offset = offset - size;
 
@@ -3584,7 +3584,7 @@ static int handle_option_done(struct tracecmd_input *handle, char *buf, int size
 	if (!offset)
 		return 0;
 
-	if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	return handle_options(handle);
@@ -3741,7 +3741,7 @@ static int handle_options(struct tracecmd_input *handle)
 	int ret;
 
 	if (!HAS_SECTIONS(handle)) {
-		handle->options_start = lseek64(handle->fd, 0, SEEK_CUR);
+		handle->options_start = lseek(handle->fd, 0, SEEK_CUR);
 	} else {
 		if (read_section_header(handle, &id, &flags, NULL, NULL))
 			return -1;
@@ -4102,7 +4102,7 @@ int init_latency_data(struct tracecmd_input *handle)
 		if (ret)
 			return -1;
 
-		lseek64(handle->latz.fd, 0, SEEK_SET);
+		lseek(handle->latz.fd, 0, SEEK_SET);
 	}
 
 	return 0;
@@ -4118,7 +4118,7 @@ static int init_buffer_cpu_data(struct tracecmd_input *handle, struct input_buff
 	if (handle->cpu_data)
 		return -1;
 
-	if (lseek64(handle->fd, buffer->offset, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, buffer->offset, SEEK_SET) == (off_t)-1)
 		return -1;
 	if (read_section_header(handle, &id, &flags, NULL, NULL))
 		return -1;
@@ -4246,7 +4246,7 @@ static int read_and_parse_cmdlines(struct tracecmd_input *handle)
 
 	if (!HAS_SECTIONS(handle))
 		section_add_or_update(handle, TRACECMD_OPTION_CMDLINES, 0, 0,
-				      lseek64(handle->fd, 0, SEEK_CUR));
+				      lseek(handle->fd, 0, SEEK_CUR));
 
 
 	if (read_data_and_size(handle, &cmdlines, &size) < 0)
@@ -4554,9 +4554,9 @@ static int read_metadata_strings(struct tracecmd_input *handle)
 	unsigned short id;
 	unsigned int csize, rsize;
 	unsigned long long size;
-	off64_t offset;
+	off_t offset;
 
-	offset = lseek64(handle->fd, 0, SEEK_CUR);
+	offset = lseek(handle->fd, 0, SEEK_CUR);
 	do {
 		if (read_section_header(handle, &id, &flags, &size, NULL))
 			break;
@@ -4575,12 +4575,12 @@ static int read_metadata_strings(struct tracecmd_input *handle)
 			if (flags & TRACECMD_SEC_FL_COMPRESS)
 				in_uncompress_reset(handle);
 		} else {
-			if (lseek64(handle->fd, size, SEEK_CUR) == (off_t)-1)
+			if (lseek(handle->fd, size, SEEK_CUR) == (off_t)-1)
 				break;
 		}
 	} while (1);
 
-	if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	return found ? 0 : -1;
@@ -4683,9 +4683,9 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd, int flags)
 	handle->page_size = page_size;
 	handle->next_offset = page_size;
 
-	offset = lseek64(handle->fd, 0, SEEK_CUR);
-	handle->total_file_size = lseek64(handle->fd, 0, SEEK_END);
-	lseek64(handle->fd, offset, SEEK_SET);
+	offset = lseek(handle->fd, 0, SEEK_CUR);
+	handle->total_file_size = lseek(handle->fd, 0, SEEK_END);
+	lseek(handle->fd, offset, SEEK_SET);
 
 	if (HAS_COMPRESSION(handle)) {
 		zname = read_string(handle);
@@ -5533,7 +5533,7 @@ static int copy_options_recursive(struct tracecmd_input *in_handle,
 			if (!next)
 				break;
 
-			if (do_lseek(in_handle, next, SEEK_SET) == (off64_t)-1)
+			if (do_lseek(in_handle, next, SEEK_SET) == (off_t)-1)
 				return -1;
 
 			if (read_section_header(in_handle, &id, &flags, NULL, NULL))
@@ -5648,7 +5648,7 @@ int tracecmd_copy_options(struct tracecmd_input *in_handle,
 	if (!in_handle->options_start)
 		return 0;
 
-	if (lseek64(in_handle->fd, in_handle->options_start, SEEK_SET) == (off64_t)-1)
+	if (lseek(in_handle->fd, in_handle->options_start, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	if (copy_options(in_handle, out_handle) < 0)
@@ -5980,10 +5980,10 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx)
 	new_handle->pid_maps = NULL;
 	if (!HAS_SECTIONS(handle)) {
 		/* Save where we currently are */
-		offset = lseek64(handle->fd, 0, SEEK_CUR);
+		offset = lseek(handle->fd, 0, SEEK_CUR);
 
-		ret = lseek64(handle->fd, buffer->offset, SEEK_SET);
-		if (ret == (off64_t)-1) {
+		ret = lseek(handle->fd, buffer->offset, SEEK_SET);
+		if (ret == (off_t)-1) {
 			tracecmd_warning("could not seek to buffer %s offset %ld",
 					  buffer->name, buffer->offset);
 			goto error;
@@ -6001,7 +6001,7 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx)
 			tracecmd_warning("failed to read sub buffer %s", buffer->name);
 			goto error;
 		}
-		ret = lseek64(handle->fd, offset, SEEK_SET);
+		ret = lseek(handle->fd, offset, SEEK_SET);
 		if (ret < 0) {
 			tracecmd_warning("could not seek to back to offset %ld", offset);
 			goto error;
@@ -6171,13 +6171,13 @@ const char *tracecmd_get_version(struct tracecmd_input *handle)
  *
  * Provides a method to extract the cpu file size saved in @handle.
  *
- * Returns the cpu file size saved in trace.dat file or (off64_t)-1 for
+ * Returns the cpu file size saved in trace.dat file or (off_t)-1 for
  * invalid cpu index.
  */
-off64_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu)
+off_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu)
 {
 	if (cpu < 0 || cpu >= handle->cpus)
-		return (off64_t)-1;
+		return (off_t)-1;
 	return handle->cpu_data[cpu].file_size;
 }
 
diff --git a/lib/trace-cmd/trace-msg.c b/lib/trace-cmd/trace-msg.c
index 0b2de710..3a555c36 100644
--- a/lib/trace-cmd/trace-msg.c
+++ b/lib/trace-cmd/trace-msg.c
@@ -183,26 +183,26 @@ static int __msg_write(int fd, struct tracecmd_msg *msg, bool network)
 	return __do_write_check(fd, msg->buf, data_size);
 }
 
-__hidden off64_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off64_t offset, int whence)
+__hidden off_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off_t offset, int whence)
 {
-	off64_t cache_offset = msg_handle->cache_start_offset;
-	off64_t ret;
+	off_t cache_offset = msg_handle->cache_start_offset;
+	off_t ret;
 
 	/*
 	 * lseek works only if the handle is in cache mode,
 	 * cannot seek on a network socket
 	 */
 	if (!msg_handle->cache || msg_handle->cfd < 0)
-		return (off64_t)-1;
+		return (off_t)-1;
 
 	if (whence == SEEK_SET) {
 		if (offset < cache_offset)
-			return (off64_t)-1;
+			return (off_t)-1;
 		offset -= cache_offset;
 	}
 
-	ret = lseek64(msg_handle->cfd, offset, whence);
-	if (ret == (off64_t)-1)
+	ret = lseek(msg_handle->cfd, offset, whence);
+	if (ret == (off_t)-1)
 		return ret;
 
 	return ret + cache_offset;
@@ -639,7 +639,7 @@ static int flush_cache(struct tracecmd_msg_handle *msg_handle)
 	if (!msg_handle->cache || fd < 0)
 		return 0;
 	msg_handle->cache = false;
-	if (lseek64(fd, 0, SEEK_SET) == (off64_t)-1)
+	if (lseek(fd, 0, SEEK_SET) == (off_t)-1)
 		return -1;
 	do {
 		ret = read(fd, buf, MSG_MAX_DATA_LEN);
@@ -650,8 +650,8 @@ static int flush_cache(struct tracecmd_msg_handle *msg_handle)
 			break;
 	} while (ret >= 0);
 
-	msg_handle->cache_start_offset = lseek64(fd, 0, SEEK_CUR);
-	if (msg_handle->cache_start_offset == (off64_t)-1)
+	msg_handle->cache_start_offset = lseek(fd, 0, SEEK_CUR);
+	if (msg_handle->cache_start_offset == (off_t)-1)
 		return -1;
 
 	close(fd);
diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index 1c0f7b77..ad740d65 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -112,7 +112,7 @@ do_write_check(struct tracecmd_output *handle, const void *data, long long size)
 	return __do_write_check(handle->fd, data, size);
 }
 
-static inline off64_t do_lseek(struct tracecmd_output *handle, off_t offset, int whence)
+static inline off_t do_lseek(struct tracecmd_output *handle, off_t offset, int whence)
 {
 	if (handle->do_compress)
 		return tracecmd_compress_lseek(handle->compress, offset, whence);
@@ -120,7 +120,7 @@ static inline off64_t do_lseek(struct tracecmd_output *handle, off_t offset, int
 	if (handle->msg_handle)
 		return msg_lseek(handle->msg_handle, offset, whence);
 
-	return lseek64(handle->fd, offset, whence);
+	return lseek(handle->fd, offset, whence);
 }
 
 static inline int do_preed(struct tracecmd_output *handle, void *dst, int len, off_t offset)
@@ -526,12 +526,12 @@ out_write_section_header(struct tracecmd_output *handle, unsigned short header_i
 	/* Section ID */
 	endian2 = convert_endian_2(handle, header_id);
 	if (do_write_check(handle, &endian2, 2))
-		return (off64_t)-1;
+		return (off_t)-1;
 
 	/* Section flags */
 	endian2 = convert_endian_2(handle, flags);
 	if (do_write_check(handle, &endian2, 2))
-		return (off64_t)-1;
+		return (off_t)-1;
 
 	/* Section description */
 	if (description)
@@ -540,13 +540,13 @@ out_write_section_header(struct tracecmd_output *handle, unsigned short header_i
 		desc = -1;
 	endian4 = convert_endian_4(handle, desc);
 	if (do_write_check(handle, &endian4, 4))
-		return (off64_t)-1;
+		return (off_t)-1;
 
 	offset = do_lseek(handle, 0, SEEK_CUR);
 	size = 0;
 	/* Reserve for section size */
 	if (do_write_check(handle, &size, 8))
-		return (off64_t)-1;
+		return (off_t)-1;
 	return offset;
 }
 
@@ -567,13 +567,13 @@ __hidden int out_update_section_header(struct tracecmd_output *handle, tsize_t o
 	if (size < 8)
 		return -1;
 	size -= 8;
-	if (do_lseek(handle, offset, SEEK_SET) == (off64_t)-1)
+	if (do_lseek(handle, offset, SEEK_SET) == (off_t)-1)
 		return -1;
 
 	endian8 = convert_endian_8(handle, size);
 	if (do_write_check(handle, &endian8, 8))
 		return -1;
-	if (do_lseek(handle, current, SEEK_SET) == (off64_t)-1)
+	if (do_lseek(handle, current, SEEK_SET) == (off_t)-1)
 		return -1;
 	return 0;
 }
@@ -595,7 +595,7 @@ static int save_string_section(struct tracecmd_output *handle, bool compress)
 	if (compress)
 		flags |= TRACECMD_SEC_FL_COMPRESS;
 	offset = out_write_section_header(handle, TRACECMD_OPTION_STRINGS, "strings", flags, false);
-	if (offset == (off64_t)-1)
+	if (offset == (off_t)-1)
 		return -1;
 
 	out_compression_start(handle, compress);
@@ -645,7 +645,7 @@ static int read_header_files(struct tracecmd_output *handle, bool compress)
 		flags |= TRACECMD_SEC_FL_COMPRESS;
 	offset = out_write_section_header(handle, TRACECMD_OPTION_HEADER_INFO,
 					  "headers", flags, true);
-	if (offset == (off64_t)-1)
+	if (offset == (off_t)-1)
 		return -1;
 
 	out_compression_start(handle, compress);
@@ -973,7 +973,7 @@ static int read_ftrace_files(struct tracecmd_output *handle, bool compress)
 		flags |= TRACECMD_SEC_FL_COMPRESS;
 	offset = out_write_section_header(handle, TRACECMD_OPTION_FTRACE_EVENTS,
 					  "ftrace events", flags, true);
-	if (offset == (off64_t)-1)
+	if (offset == (off_t)-1)
 		return -1;
 
 	create_event_list_item(handle, &systems, &list);
@@ -1032,7 +1032,7 @@ static int read_event_files(struct tracecmd_output *handle,
 		flags |= TRACECMD_SEC_FL_COMPRESS;
 	offset = out_write_section_header(handle, TRACECMD_OPTION_EVENT_FORMATS,
 					  "events format", flags, true);
-	if (offset == (off64_t)-1)
+	if (offset == (off_t)-1)
 		return -1;
 	/*
 	 * If any of the list is the special keyword "all" then
@@ -1146,7 +1146,7 @@ static int read_proc_kallsyms(struct tracecmd_output *handle, bool compress)
 		flags |= TRACECMD_SEC_FL_COMPRESS;
 	offset = out_write_section_header(handle, TRACECMD_OPTION_KALLSYMS,
 					  "kallsyms", flags, true);
-	if (offset == (off64_t)-1)
+	if (offset == (off_t)-1)
 		return -1;
 
 	out_compression_start(handle, compress);
@@ -1210,7 +1210,7 @@ static int read_ftrace_printk(struct tracecmd_output *handle, bool compress)
 	if (compress)
 		flags |= TRACECMD_SEC_FL_COMPRESS;
 	offset = out_write_section_header(handle, TRACECMD_OPTION_PRINTK, "printk", flags, true);
-	if (offset == (off64_t)-1)
+	if (offset == (off_t)-1)
 		return -1;
 
 	out_compression_start(handle, compress);
@@ -1255,8 +1255,8 @@ static int save_tracing_file_data(struct tracecmd_output *handle,
 	unsigned long long endian8;
 	char *file = NULL;
 	struct stat st;
-	off64_t check_size;
-	off64_t size;
+	off_t check_size;
+	off_t size;
 	int ret = -1;
 
 	file = get_tracing_file(handle, filename);
@@ -1850,9 +1850,9 @@ static int write_options_v6(struct tracecmd_output *handle)
 	return 0;
 }
 
-static int update_options_start(struct tracecmd_output *handle, off64_t offset)
+static int update_options_start(struct tracecmd_output *handle, off_t offset)
 {
-	if (do_lseek(handle, handle->options_start, SEEK_SET) == (off64_t)-1)
+	if (do_lseek(handle, handle->options_start, SEEK_SET) == (off_t)-1)
 		return -1;
 	offset = convert_endian_8(handle, offset);
 	if (do_write_check(handle, &offset, 8))
@@ -1875,7 +1875,7 @@ static int update_options_start(struct tracecmd_output *handle, off64_t offset)
  *
  * Returns zero on success and -1 on error.
  */
-int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int whence)
+int tracecmd_prepare_options(struct tracecmd_output *handle, off_t offset, int whence)
 {
 	tsize_t curr;
 	int ret;
@@ -1895,7 +1895,7 @@ int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int
 		break;
 	case SEEK_END:
 		offset = do_lseek(handle, offset, SEEK_END);
-		if (offset == (off64_t)-1)
+		if (offset == (off_t)-1)
 			return -1;
 		break;
 	}
@@ -2067,7 +2067,7 @@ __hidden void *trace_get_options(struct tracecmd_output *handle, size_t *len)
 	if (!buf)
 		goto out;
 
-	if (do_lseek(&out_handle, 0, SEEK_SET) == (off64_t)-1)
+	if (do_lseek(&out_handle, 0, SEEK_SET) == (off_t)-1)
 		goto out;
 	*len = read(msg_handle.cfd, buf, offset);
 	if (*len != offset) {
@@ -2278,7 +2278,7 @@ int tracecmd_write_cmdlines(struct tracecmd_output *handle)
 		flags |= TRACECMD_SEC_FL_COMPRESS;
 	offset = out_write_section_header(handle, TRACECMD_OPTION_CMDLINES,
 					  "command lines", flags, true);
-	if (offset == (off64_t)-1)
+	if (offset == (off_t)-1)
 		return -1;
 
 	out_compression_start(handle, compress);
@@ -2527,7 +2527,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle,
 	current = do_lseek(handle, 0, SEEK_CUR);
 
 	/* Go to the option data, where will write the offest */
-	if (do_lseek(handle, b_offset, SEEK_SET) == (off64_t)-1) {
+	if (do_lseek(handle, b_offset, SEEK_SET) == (off_t)-1) {
 		tracecmd_warning("could not seek to %lld", b_offset);
 		return -1;
 	}
@@ -2536,7 +2536,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle,
 		return -1;
 
 	/* Go back to end of file */
-	if (do_lseek(handle, current, SEEK_SET) == (off64_t)-1) {
+	if (do_lseek(handle, current, SEEK_SET) == (off_t)-1) {
 		tracecmd_warning("could not seek to %lld", offset);
 		return -1;
 	}
@@ -2660,7 +2660,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 		data_files[i].data_offset &= ~(page_size - 1);
 
 		ret = do_lseek(handle, data_files[i].data_offset, SEEK_SET);
-		if (ret == (off64_t)-1)
+		if (ret == (off_t)-1)
 			goto out_free;
 
 		if (!tracecmd_get_quiet(handle))
@@ -2668,7 +2668,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 				i, (unsigned long long)data_files[i].data_offset);
 
 		if (data[i].size) {
-			if (lseek64(data[i].fd, data[i].offset, SEEK_SET) == (off64_t)-1)
+			if (lseek(data[i].fd, data[i].offset, SEEK_SET) == (off_t)-1)
 				goto out_free;
 			read_size = out_copy_fd_compress(handle, data[i].fd,
 							 data[i].size, &data_files[i].write_size,
@@ -2686,19 +2686,19 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 
 		if (!HAS_SECTIONS(handle)) {
 			/* Write the real CPU data offset in the file */
-			if (do_lseek(handle, data_files[i].file_data_offset, SEEK_SET) == (off64_t)-1)
+			if (do_lseek(handle, data_files[i].file_data_offset, SEEK_SET) == (off_t)-1)
 				goto out_free;
 			endian8 = convert_endian_8(handle, data_files[i].data_offset);
 			if (do_write_check(handle, &endian8, 8))
 				goto out_free;
 			/* Write the real CPU data size in the file */
-			if (do_lseek(handle, data_files[i].file_write_size, SEEK_SET) == (off64_t)-1)
+			if (do_lseek(handle, data_files[i].file_write_size, SEEK_SET) == (off_t)-1)
 				goto out_free;
 			endian8 = convert_endian_8(handle, data_files[i].write_size);
 			if (do_write_check(handle, &endian8, 8))
 				goto out_free;
 			offset = data_files[i].data_offset + data_files[i].write_size;
-			if (do_lseek(handle, offset, SEEK_SET) == (off64_t)-1)
+			if (do_lseek(handle, offset, SEEK_SET) == (off_t)-1)
 				goto out_free;
 		}
 		if (!tracecmd_get_quiet(handle)) {
@@ -2717,7 +2717,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 		goto out_free;
 
 	free(data_files);
-	if (do_lseek(handle, 0, SEEK_END) == (off64_t)-1)
+	if (do_lseek(handle, 0, SEEK_END) == (off_t)-1)
 		return -1;
 
 	if (out_update_section_header(handle, offset))
@@ -2986,7 +2986,7 @@ __hidden int out_save_options_offset(struct tracecmd_output *handle, unsigned lo
 			return -1;
 
 		new = do_lseek(handle, 0, SEEK_CUR);
-		if (do_lseek(handle, handle->options_start, SEEK_SET) == (off64_t)-1)
+		if (do_lseek(handle, handle->options_start, SEEK_SET) == (off_t)-1)
 			return -1;
 
 		en8 = convert_endian_8(handle, start);
@@ -2994,7 +2994,7 @@ __hidden int out_save_options_offset(struct tracecmd_output *handle, unsigned lo
 			return -1;
 
 		handle->options_start = new;
-		if (do_lseek(handle, new, SEEK_SET) == (off64_t)-1)
+		if (do_lseek(handle, new, SEEK_SET) == (off_t)-1)
 			return -1;
 	} else {
 		handle->options_start = start;
diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index 23499f30..c172ad64 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -51,7 +51,7 @@ static int append_file(int size, int dst, int src)
 	char buf[size];
 	int r;
 
-	lseek64(src, 0, SEEK_SET);
+	lseek(src, 0, SEEK_SET);
 
 	/* If there's an error, then we are pretty much screwed :-p */
 	do {
@@ -82,10 +82,10 @@ void tracecmd_free_recorder(struct tracecmd_recorder *recorder)
 					  recorder->fd2, recorder->fd1);
 			/* Error on copying, then just keep fd1 */
 			if (ret) {
-				lseek64(recorder->fd1, 0, SEEK_END);
+				lseek(recorder->fd1, 0, SEEK_END);
 				goto close;
 			}
-			lseek64(recorder->fd1, 0, SEEK_SET);
+			lseek(recorder->fd1, 0, SEEK_SET);
 			ftruncate(recorder->fd1, 0);
 		}
 		append_file(recorder->page_size, recorder->fd1, recorder->fd2);
@@ -305,7 +305,7 @@ static inline void update_fd(struct tracecmd_recorder *recorder, int size)
 		fd = recorder->fd1;
 
 	/* Zero out the new file we are writing to */
-	lseek64(fd, 0, SEEK_SET);
+	lseek(fd, 0, SEEK_SET);
 	ftruncate(fd, 0);
 
 	recorder->fd = fd;
diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
index 22e3d871..11c1baf1 100644
--- a/tracecmd/trace-dump.c
+++ b/tracecmd/trace-dump.c
@@ -101,7 +101,7 @@ static int do_lseek(int fd, int offset, int whence)
 	if (read_compress)
 		return tracecmd_compress_lseek(compress, offset, whence);
 
-	return lseek64(fd, offset, whence);
+	return lseek(fd, offset, whence);
 }
 
 static int read_file_string(int fd, char *dst, int len)
@@ -446,7 +446,7 @@ static void dump_section_header(int fd, enum dump_items v, unsigned short *flags
 	const char *desc;
 	int desc_id;
 
-	offset = lseek64(fd, 0, SEEK_CUR);
+	offset = lseek(fd, 0, SEEK_CUR);
 	if (read_file_number(fd, &id, 2))
 		die("cannot read the section id");
 
@@ -500,13 +500,13 @@ static void dump_option_buffer(int fd, unsigned short option, int size)
 		return;
 	}
 
-	current = lseek64(fd, 0, SEEK_CUR);
-	if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
+	current = lseek(fd, 0, SEEK_CUR);
+	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
 		die("cannot goto buffer offset %lld", offset);
 
 	dump_section_header(fd, FLYRECORD, &flags);
 
-	if (lseek64(fd, current, SEEK_SET) == (off_t)-1)
+	if (lseek(fd, current, SEEK_SET) == (off_t)-1)
 		die("cannot go back to buffer option");
 
 	do_print(OPTIONS|FLYRECORD, "\t\t[Option BUFFER, %d bytes]\n", size);
@@ -773,7 +773,7 @@ static void dump_sections(int fd, int count)
 	unsigned short flags;
 
 	while (sec) {
-		if (lseek64(fd, sec->offset, SEEK_SET) == (off_t)-1)
+		if (lseek(fd, sec->offset, SEEK_SET) == (off_t)-1)
 			die("cannot goto option offset %lld", sec->offset);
 
 		dump_section_header(fd, sec->verbosity, &flags);
@@ -826,7 +826,7 @@ static int dump_option_done(int fd, int size)
 	if (!offset)
 		return 0;
 
-	if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
 		die("cannot goto next options offset %lld", offset);
 
 	do_print(OPTIONS, "\n\n");
@@ -1006,7 +1006,7 @@ static void dump_therest(int fd)
 		else if (strncmp(str, HEAD_FLYRECORD, 10) == 0)
 			dump_flyrecord(fd);
 		else {
-			lseek64(fd, -10, SEEK_CUR);
+			lseek(fd, -10, SEEK_CUR);
 			break;
 		}
 	}
@@ -1060,7 +1060,7 @@ static void get_meta_strings(int fd)
 	unsigned short fl, id;
 	int desc_id;
 
-	offset = lseek64(fd, 0, SEEK_CUR);
+	offset = lseek(fd, 0, SEEK_CUR);
 	do {
 		if (read_file_number(fd, &id, 2))
 			break;
@@ -1074,7 +1074,7 @@ static void get_meta_strings(int fd)
 			if ((fl & TRACECMD_SEC_FL_COMPRESS)) {
 				read_file_number(fd, &csize, 4);
 				read_file_number(fd, &rsize, 4);
-				lseek64(fd, -8, SEEK_CUR);
+				lseek(fd, -8, SEEK_CUR);
 				if (uncompress_block())
 					break;
 			} else {
@@ -1083,12 +1083,12 @@ static void get_meta_strings(int fd)
 			read_metadata_strings(fd, rsize);
 			uncompress_reset();
 		} else {
-			if (lseek64(fd, size, SEEK_CUR) == (off_t)-1)
+			if (lseek(fd, size, SEEK_CUR) == (off_t)-1)
 				break;
 		}
 	} while (1);
 
-	if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
 		die("cannot restore the original file location");
 }
 
@@ -1102,9 +1102,9 @@ static int walk_v7_sections(int fd)
 	int desc_id;
 	const char *desc;
 
-	offset = lseek64(fd, 0, SEEK_CUR);
+	offset = lseek(fd, 0, SEEK_CUR);
 	do {
-		soffset = lseek64(fd, 0, SEEK_CUR);
+		soffset = lseek(fd, 0, SEEK_CUR);
 		if (read_file_number(fd, &id, 2))
 			break;
 
@@ -1149,11 +1149,11 @@ static int walk_v7_sections(int fd)
 				 id, soffset, desc, fl, size);
 		}
 
-		if (lseek64(fd, size, SEEK_CUR) == (off_t)-1)
+		if (lseek(fd, size, SEEK_CUR) == (off_t)-1)
 			break;
 	} while (1);
 
-	if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
 		die("cannot restore the original file location");
 
 	return count;
@@ -1170,7 +1170,7 @@ static void dump_v7_file(int fd)
 	get_meta_strings(fd);
 	sections = walk_v7_sections(fd);
 
-	if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
+	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
 		die("cannot goto options offset %lld", offset);
 
 	dump_options(fd);
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index 224a6dde..c094ad6a 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -195,7 +195,7 @@ static void print_event(struct trace_seq *s, struct tracecmd_input *handle,
 #define TEST_READ_AT 0
 #if TEST_READ_AT
 #define DO_TEST
-static off64_t test_read_at_offset;
+static off_t test_read_at_offset;
 static int test_read_at_copy = 100;
 static int test_read_at_index;
 static void show_test(struct tracecmd_input *handle)
-- 
2.39.0