blob: 1e5415ef6a4724d07b76f7089623d7c63bc68361 [file] [log] [blame]
Andrew Geisslerc5535c92023-01-27 16:10:19 -06001From 9c3213a3b64e049c1aa065300b01ee751699b01f Mon Sep 17 00:00:00 2001
Andrew Geissler517393d2023-01-13 08:55:19 -06002From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 6 Jan 2023 16:53:06 -0800
Andrew Geisslerc5535c92023-01-27 16:10:19 -06004Subject: [PATCH 1/2] Replace LFS64 interfaces off64_t and lseek64
Andrew Geissler517393d2023-01-13 08:55:19 -06005
6Musl does not define these interfaces unless -D_LARGEFILE64_SOURCE is
Andrew Geisslerc5535c92023-01-27 16:10:19 -06007defined and that too it is transitional until apps switch to using 64-bit
8off_t. We pass -D_FILE_OFFSET_BITS=64 in makefiles already therefore
Andrew Geissler517393d2023-01-13 08:55:19 -06009original lseek and off_t are already 64bit
10
11This fixes build with latest musl which has dropped LFS64 interfaces [1]
12
13[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4i
14
Andrew Geisslerc5535c92023-01-27 16:10:19 -060015Upstream-Status: Submitted [https://lore.kernel.org/linux-trace-devel/20230109225315.1284538-1-raj.khem@gmail.com/]
Andrew Geissler517393d2023-01-13 08:55:19 -060016Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 .../include/private/trace-cmd-private.h | 12 +-
19 lib/trace-cmd/include/trace-cmd-local.h | 4 +-
20 lib/trace-cmd/trace-compress.c | 30 ++---
21 lib/trace-cmd/trace-input.c | 110 +++++++++---------
22 lib/trace-cmd/trace-msg.c | 20 ++--
23 lib/trace-cmd/trace-output.c | 64 +++++-----
24 lib/trace-cmd/trace-recorder.c | 8 +-
25 tracecmd/trace-dump.c | 34 +++---
26 tracecmd/trace-read.c | 2 +-
27 9 files changed, 142 insertions(+), 142 deletions(-)
28
29diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
Andrew Geisslerc5535c92023-01-27 16:10:19 -060030index 05c084ce..f2cf8dc8 100644
Andrew Geissler517393d2023-01-13 08:55:19 -060031--- a/lib/trace-cmd/include/private/trace-cmd-private.h
32+++ b/lib/trace-cmd/include/private/trace-cmd-private.h
33@@ -106,7 +106,7 @@ const char *tracecmd_get_trace_clock(struct tracecmd_input *handle);
34 const char *tracecmd_get_cpustats(struct tracecmd_input *handle);
35 const char *tracecmd_get_uname(struct tracecmd_input *handle);
36 const char *tracecmd_get_version(struct tracecmd_input *handle);
37-off64_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu);
38+off_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu);
39
40 static inline int tracecmd_host_bigendian(void)
41 {
42@@ -336,7 +336,7 @@ int tracecmd_write_buffer_info(struct tracecmd_output *handle);
43
44 int tracecmd_write_cpus(struct tracecmd_output *handle, int cpus);
45 int tracecmd_write_cmdlines(struct tracecmd_output *handle);
46-int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int whence);
47+int tracecmd_prepare_options(struct tracecmd_output *handle, off_t offset, int whence);
48 int tracecmd_write_options(struct tracecmd_output *handle);
49 int tracecmd_write_meta_strings(struct tracecmd_output *handle);
50 int tracecmd_append_options(struct tracecmd_output *handle);
Andrew Geisslerc5535c92023-01-27 16:10:19 -060051@@ -394,7 +394,7 @@ struct tracecmd_msg_handle {
Andrew Geissler517393d2023-01-13 08:55:19 -060052 short cpu_count;
53 short version; /* Current protocol version */
54 unsigned long flags;
55- off64_t cache_start_offset;
56+ off_t cache_start_offset;
57 bool done;
58 bool cache;
59 int cfd;
Andrew Geisslerc5535c92023-01-27 16:10:19 -060060@@ -543,8 +543,8 @@ int tracecmd_write_guest_time_shift(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -060061 struct tracecmd_compress_chunk {
62 unsigned int size;
63 unsigned int zsize;
64- off64_t zoffset;
65- off64_t offset;
66+ off_t zoffset;
67+ off_t offset;
68 };
69 struct tracecmd_compression;
70 struct tracecmd_compression_proto {
Andrew Geisslerc5535c92023-01-27 16:10:19 -060071@@ -570,7 +570,7 @@ int tracecmd_compress_buffer_read(struct tracecmd_compression *handle, char *dst
Andrew Geissler517393d2023-01-13 08:55:19 -060072 int tracecmd_compress_pread(struct tracecmd_compression *handle, char *dst, int len, off_t offset);
73 int tracecmd_compress_buffer_write(struct tracecmd_compression *handle,
74 const void *data, unsigned long long size);
75-off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t offset, int whence);
76+off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset, int whence);
77 int tracecmd_compress_proto_get_name(struct tracecmd_compression *compress,
78 const char **name, const char **version);
79 bool tracecmd_compress_is_supported(const char *name, const char *version);
80diff --git a/lib/trace-cmd/include/trace-cmd-local.h b/lib/trace-cmd/include/trace-cmd-local.h
81index db0b2c21..ebd6f152 100644
82--- a/lib/trace-cmd/include/trace-cmd-local.h
83+++ b/lib/trace-cmd/include/trace-cmd-local.h
84@@ -94,13 +94,13 @@ out_add_buffer_option(struct tracecmd_output *handle, const char *name,
85 struct cpu_data_source {
86 int fd;
87 int size;
88- off64_t offset;
89+ off_t offset;
90 };
91
92 int out_write_cpu_data(struct tracecmd_output *handle, int cpus,
93 struct cpu_data_source *data, const char *buff_name);
94 int out_write_emty_cpu_data(struct tracecmd_output *handle, int cpus);
95-off64_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off64_t offset, int whence);
96+off_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off_t offset, int whence);
97 unsigned long long get_last_option_offset(struct tracecmd_input *handle);
98 unsigned int get_meta_strings_size(struct tracecmd_input *handle);
99 int trace_append_options(struct tracecmd_output *handle, void *buf, size_t len);
100diff --git a/lib/trace-cmd/trace-compress.c b/lib/trace-cmd/trace-compress.c
101index 461de8d0..1b852f18 100644
102--- a/lib/trace-cmd/trace-compress.c
103+++ b/lib/trace-cmd/trace-compress.c
104@@ -117,12 +117,12 @@ static inline int buffer_extend(struct tracecmd_compression *handle, unsigned in
105 *
106 * Returns the new file pointer on success, or -1 in case of an error.
107 */
108-off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t offset, int whence)
109+off_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off_t offset, int whence)
110 {
111 unsigned long p;
112
113 if (!handle || !handle->buffer)
114- return (off64_t)-1;
115+ return (off_t)-1;
116
117 switch (whence) {
118 case SEEK_CUR:
119@@ -135,11 +135,11 @@ off64_t tracecmd_compress_lseek(struct tracecmd_compression *handle, off64_t off
120 p = offset;
121 break;
122 default:
123- return (off64_t)-1;
124+ return (off_t)-1;
125 }
126
127 if (buffer_extend(handle, p))
128- return (off64_t)-1;
129+ return (off_t)-1;
130
131 handle->pointer = p;
132
133@@ -678,7 +678,7 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int
134 unsigned int size;
135 unsigned int all;
136 unsigned int r;
137- off64_t offset;
138+ off_t offset;
139 char *buf_from;
140 char *buf_to;
141 int endian4;
142@@ -700,7 +700,7 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int
143 return -1;
144
145 /* save the initial offset and write 0 as initial chunk count */
146- offset = lseek64(handle->fd, 0, SEEK_CUR);
147+ offset = lseek(handle->fd, 0, SEEK_CUR);
148 write_fd(handle->fd, &chunks, 4);
149
150 do {
151@@ -760,13 +760,13 @@ int tracecmd_compress_copy_from(struct tracecmd_compression *handle, int fd, int
152 if (all)
153 return -1;
154
155- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
156+ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
157 return -1;
158
159 endian4 = tep_read_number(handle->tep, &chunks, 4);
160 /* write chunks count*/
161 write_fd(handle->fd, &chunks, 4);
162- if (lseek64(handle->fd, 0, SEEK_END) == (off_t)-1)
163+ if (lseek(handle->fd, 0, SEEK_END) == (off_t)-1)
164 return -1;
165
166 if (read_size)
167@@ -796,7 +796,7 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
168 struct tracecmd_compress_chunk *chunks = NULL;
169 unsigned long long size = 0;
170 unsigned int count = 0;
171- off64_t offset;
172+ off_t offset;
173 int ret = -1;
174 char buf[4];
175 int i;
176@@ -804,8 +804,8 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
177 if (!handle)
178 return -1;
179
180- offset = lseek64(handle->fd, 0, SEEK_CUR);
181- if (offset == (off64_t)-1)
182+ offset = lseek(handle->fd, 0, SEEK_CUR);
183+ if (offset == (off_t)-1)
184 return -1;
185
186 if (read(handle->fd, buf, 4) != 4)
187@@ -822,7 +822,7 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
188 goto out;
189
190 for (i = 0; i < count; i++) {
191- chunks[i].zoffset = lseek64(handle->fd, 0, SEEK_CUR);
192+ chunks[i].zoffset = lseek(handle->fd, 0, SEEK_CUR);
193 if (chunks[i].zoffset == (off_t)-1)
194 goto out;
195 if (read(handle->fd, buf, 4) != 4)
196@@ -833,13 +833,13 @@ int tracecmd_load_chunks_info(struct tracecmd_compression *handle,
197 goto out;
198 chunks[i].size = tep_read_number(handle->tep, buf, 4);
199 size += chunks[i].size;
200- if (lseek64(handle->fd, chunks[i].zsize, SEEK_CUR) == (off64_t)-1)
201+ if (lseek(handle->fd, chunks[i].zsize, SEEK_CUR) == (off_t)-1)
202 goto out;
203 }
204
205 ret = count;
206 out:
207- if (lseek64(handle->fd, offset, SEEK_SET) == (off64_t)-1)
208+ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
209 ret = -1;
210
211 if (ret > 0 && chunks_info)
212@@ -872,7 +872,7 @@ int tracecmd_uncompress_chunk(struct tracecmd_compression *handle,
213 if (!handle || !handle->proto || !handle->proto->uncompress_block || !chunk || !data)
214 return -1;
215
216- if (lseek64(handle->fd, chunk->zoffset + 8, SEEK_SET) == (off_t)-1)
217+ if (lseek(handle->fd, chunk->zoffset + 8, SEEK_SET) == (off_t)-1)
218 return -1;
219
220 bytes_in = malloc(chunk->zsize);
221diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
222index 594eb74a..9b128403 100644
223--- a/lib/trace-cmd/trace-input.c
224+++ b/lib/trace-cmd/trace-input.c
225@@ -37,8 +37,8 @@ static int force_read = 0;
226
227 struct page_map {
228 struct list_head list;
229- off64_t offset;
230- off64_t size;
231+ off_t offset;
232+ off_t size;
233 void *map;
234 int ref_count;
235 };
236@@ -54,7 +54,7 @@ struct follow_event {
237
238 struct page {
239 struct list_head list;
240- off64_t offset;
241+ off_t offset;
242 struct tracecmd_input *handle;
243 struct page_map *page_map;
244 void *map;
245@@ -541,7 +541,7 @@ static struct file_section *section_open(struct tracecmd_input *handle, int id)
246 if (!sec)
247 return NULL;
248
249- if (lseek64(handle->fd, sec->data_offset, SEEK_SET) == (off64_t)-1)
250+ if (lseek(handle->fd, sec->data_offset, SEEK_SET) == (off_t)-1)
251 return NULL;
252
253 if ((sec->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle))
254@@ -593,7 +593,7 @@ static int read_header_files(struct tracecmd_input *handle)
255
256 if (!HAS_SECTIONS(handle))
257 section_add_or_update(handle, TRACECMD_OPTION_HEADER_INFO, 0, 0,
258- lseek64(handle->fd, 0, SEEK_CUR));
259+ lseek(handle->fd, 0, SEEK_CUR));
260
261 if (do_read_check(handle, buf, 12))
262 return -1;
263@@ -800,7 +800,7 @@ static int read_ftrace_files(struct tracecmd_input *handle, const char *regex)
264
265 if (!HAS_SECTIONS(handle))
266 section_add_or_update(handle, TRACECMD_OPTION_FTRACE_EVENTS, 0, 0,
267- lseek64(handle->fd, 0, SEEK_CUR));
268+ lseek(handle->fd, 0, SEEK_CUR));
269
270 if (regex) {
271 sreg = &spreg;
272@@ -875,7 +875,7 @@ static int read_event_files(struct tracecmd_input *handle, const char *regex)
273
274 if (!HAS_SECTIONS(handle))
275 section_add_or_update(handle, TRACECMD_OPTION_EVENT_FORMATS, 0, 0,
276- lseek64(handle->fd, 0, SEEK_CUR));
277+ lseek(handle->fd, 0, SEEK_CUR));
278
279 if (regex) {
280 sreg = &spreg;
281@@ -962,7 +962,7 @@ static int read_proc_kallsyms(struct tracecmd_input *handle)
282 return 0;
283 if (!HAS_SECTIONS(handle))
284 section_add_or_update(handle, TRACECMD_OPTION_KALLSYMS, 0, 0,
285- lseek64(handle->fd, 0, SEEK_CUR));
286+ lseek(handle->fd, 0, SEEK_CUR));
287
288 if (read4(handle, &size) < 0)
289 return -1;
290@@ -999,7 +999,7 @@ static int read_ftrace_printk(struct tracecmd_input *handle)
291
292 if (!HAS_SECTIONS(handle))
293 section_add_or_update(handle, TRACECMD_OPTION_PRINTK, 0, 0,
294- lseek64(handle->fd, 0, SEEK_CUR));
295+ lseek(handle->fd, 0, SEEK_CUR));
296
297 if (read4(handle, &size) < 0)
298 return -1;
299@@ -1173,7 +1173,7 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se
300 unsigned long long size;
301 int ret;
302
303- if (lseek64(handle->fd, section->section_offset, SEEK_SET) == (off_t)-1)
304+ if (lseek(handle->fd, section->section_offset, SEEK_SET) == (off_t)-1)
305 return -1;
306 if (read_section_header(handle, &id, &flags, &size, NULL))
307 return -1;
308@@ -1181,7 +1181,7 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se
309 if (id != section->id)
310 return -1;
311
312- section->data_offset = lseek64(handle->fd, 0, SEEK_CUR);
313+ section->data_offset = lseek(handle->fd, 0, SEEK_CUR);
314 if ((section->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle))
315 return -1;
316
317@@ -1225,7 +1225,7 @@ static int read_headers(struct tracecmd_input *handle, const char *regex)
318 if (!handle->options_start)
319 return -1;
320
321- if (lseek64(handle->fd, handle->options_start, SEEK_SET) == (off64_t)-1) {
322+ if (lseek(handle->fd, handle->options_start, SEEK_SET) == (off_t)-1) {
323 tracecmd_warning("Filed to goto options offset %lld", handle->options_start);
324 return -1;
325 }
326@@ -1269,11 +1269,11 @@ static unsigned long long calc_page_offset(struct tracecmd_input *handle,
327 return offset & ~(handle->page_size - 1);
328 }
329
330-static int read_page(struct tracecmd_input *handle, off64_t offset,
331+static int read_page(struct tracecmd_input *handle, off_t offset,
332 int cpu, void *map)
333 {
334- off64_t save_seek;
335- off64_t ret;
336+ off_t save_seek;
337+ off_t ret;
338
339 if (handle->use_pipe) {
340 ret = read(handle->cpu_data[cpu].pipe_fd, map, handle->page_size);
341@@ -1291,9 +1291,9 @@ static int read_page(struct tracecmd_input *handle, off64_t offset,
342 }
343
344 /* other parts of the code may expect the pointer to not move */
345- save_seek = lseek64(handle->fd, 0, SEEK_CUR);
346+ save_seek = lseek(handle->fd, 0, SEEK_CUR);
347
348- ret = lseek64(handle->fd, offset, SEEK_SET);
349+ ret = lseek(handle->fd, offset, SEEK_SET);
350 if (ret < 0)
351 return -1;
352 ret = read(handle->fd, map, handle->page_size);
353@@ -1301,7 +1301,7 @@ static int read_page(struct tracecmd_input *handle, off64_t offset,
354 return -1;
355
356 /* reset the file pointer back */
357- lseek64(handle->fd, save_seek, SEEK_SET);
358+ lseek(handle->fd, save_seek, SEEK_SET);
359
360 return 0;
361 }
362@@ -1348,7 +1348,7 @@ static int chunk_cmp(const void *A, const void *B)
363 return 1;
364 }
365
366-static struct tracecmd_compress_chunk *get_zchunk(struct cpu_data *cpu, off64_t offset)
367+static struct tracecmd_compress_chunk *get_zchunk(struct cpu_data *cpu, off_t offset)
368 {
369 struct cpu_zdata *cpuz = &cpu->compress;
370 struct tracecmd_compress_chunk *chunk;
371@@ -1398,7 +1398,7 @@ found:
372 free(cache);
373 }
374
375-static void *read_zpage(struct tracecmd_input *handle, int cpu, off64_t offset)
376+static void *read_zpage(struct tracecmd_input *handle, int cpu, off_t offset)
377 {
378 struct cpu_data *cpu_data = &handle->cpu_data[cpu];
379 struct tracecmd_compress_chunk *chunk;
380@@ -1448,12 +1448,12 @@ error:
381 }
382
383 static void *allocate_page_map(struct tracecmd_input *handle,
384- struct page *page, int cpu, off64_t offset)
385+ struct page *page, int cpu, off_t offset)
386 {
387 struct cpu_data *cpu_data = &handle->cpu_data[cpu];
388 struct page_map *page_map;
389- off64_t map_size;
390- off64_t map_offset;
391+ off_t map_size;
392+ off_t map_offset;
393 void *map;
394 int ret;
395 int fd;
396@@ -1544,7 +1544,7 @@ static void *allocate_page_map(struct tracecmd_input *handle,
397 }
398
399 static struct page *allocate_page(struct tracecmd_input *handle,
400- int cpu, off64_t offset)
401+ int cpu, off_t offset)
402 {
403 struct cpu_data *cpu_data = &handle->cpu_data[cpu];
404 struct page **pages;
405@@ -1851,7 +1851,7 @@ static int update_page_info(struct tracecmd_input *handle, int cpu)
406 * -1 on error
407 */
408 static int get_page(struct tracecmd_input *handle, int cpu,
409- off64_t offset)
410+ off_t offset)
411 {
412 /* Don't map if the page is already where we want */
413 if (handle->cpu_data[cpu].offset == offset &&
414@@ -1895,7 +1895,7 @@ static int get_page(struct tracecmd_input *handle, int cpu,
415
416 static int get_next_page(struct tracecmd_input *handle, int cpu)
417 {
418- off64_t offset;
419+ off_t offset;
420
421 if (!handle->cpu_data[cpu].page && !handle->use_pipe)
422 return 0;
423@@ -2122,7 +2122,7 @@ struct tep_record *
424 tracecmd_read_cpu_last(struct tracecmd_input *handle, int cpu)
425 {
426 struct tep_record *record = NULL;
427- off64_t offset, page_offset;
428+ off_t offset, page_offset;
429
430 offset = handle->cpu_data[cpu].file_offset +
431 handle->cpu_data[cpu].file_size;
432@@ -2183,7 +2183,7 @@ tracecmd_set_cpu_to_timestamp(struct tracecmd_input *handle, int cpu,
433 unsigned long long ts)
434 {
435 struct cpu_data *cpu_data = &handle->cpu_data[cpu];
436- off64_t start, end, next;
437+ off_t start, end, next;
438
439 if (cpu < 0 || cpu >= handle->cpus) {
440 errno = -EINVAL;
441@@ -3064,11 +3064,11 @@ static int init_cpu_zfile(struct tracecmd_input *handle, int cpu)
442 {
443 struct cpu_data *cpu_data;
444 unsigned long long size;
445- off64_t offset;
446+ off_t offset;
447
448 cpu_data = &handle->cpu_data[cpu];
449- offset = lseek64(handle->fd, 0, SEEK_CUR);
450- if (lseek64(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
451+ offset = lseek(handle->fd, 0, SEEK_CUR);
452+ if (lseek(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
453 return -1;
454
455 strcpy(cpu_data->compress.file, COMPR_TEMP_FILE);
456@@ -3079,7 +3079,7 @@ static int init_cpu_zfile(struct tracecmd_input *handle, int cpu)
457 if (tracecmd_uncompress_copy_to(handle->compress, cpu_data->compress.fd, NULL, &size))
458 return -1;
459
460- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
461+ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
462 return -1;
463
464 cpu_data->file_offset = handle->next_offset;
465@@ -3098,7 +3098,7 @@ static int init_cpu_zpage(struct tracecmd_input *handle, int cpu)
466 int count;
467 int i;
468
469- if (lseek64(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
470+ if (lseek(handle->fd, cpu_data->file_offset, SEEK_SET) == (off_t)-1)
471 return -1;
472
473 count = tracecmd_load_chunks_info(handle->compress, &cpu_data->compress.chunks);
474@@ -3576,7 +3576,7 @@ static int handle_option_done(struct tracecmd_input *handle, char *buf, int size
475 if (size < 8)
476 return -1;
477
478- offset = lseek64(handle->fd, 0, SEEK_CUR);
479+ offset = lseek(handle->fd, 0, SEEK_CUR);
480 if (offset >= size)
481 handle->options_last_offset = offset - size;
482
483@@ -3584,7 +3584,7 @@ static int handle_option_done(struct tracecmd_input *handle, char *buf, int size
484 if (!offset)
485 return 0;
486
487- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
488+ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
489 return -1;
490
491 return handle_options(handle);
492@@ -3741,7 +3741,7 @@ static int handle_options(struct tracecmd_input *handle)
493 int ret;
494
495 if (!HAS_SECTIONS(handle)) {
496- handle->options_start = lseek64(handle->fd, 0, SEEK_CUR);
497+ handle->options_start = lseek(handle->fd, 0, SEEK_CUR);
498 } else {
499 if (read_section_header(handle, &id, &flags, NULL, NULL))
500 return -1;
501@@ -4102,7 +4102,7 @@ int init_latency_data(struct tracecmd_input *handle)
502 if (ret)
503 return -1;
504
505- lseek64(handle->latz.fd, 0, SEEK_SET);
506+ lseek(handle->latz.fd, 0, SEEK_SET);
507 }
508
509 return 0;
510@@ -4118,7 +4118,7 @@ static int init_buffer_cpu_data(struct tracecmd_input *handle, struct input_buff
511 if (handle->cpu_data)
512 return -1;
513
514- if (lseek64(handle->fd, buffer->offset, SEEK_SET) == (off_t)-1)
515+ if (lseek(handle->fd, buffer->offset, SEEK_SET) == (off_t)-1)
516 return -1;
517 if (read_section_header(handle, &id, &flags, NULL, NULL))
518 return -1;
519@@ -4246,7 +4246,7 @@ static int read_and_parse_cmdlines(struct tracecmd_input *handle)
520
521 if (!HAS_SECTIONS(handle))
522 section_add_or_update(handle, TRACECMD_OPTION_CMDLINES, 0, 0,
523- lseek64(handle->fd, 0, SEEK_CUR));
524+ lseek(handle->fd, 0, SEEK_CUR));
525
526
527 if (read_data_and_size(handle, &cmdlines, &size) < 0)
528@@ -4554,9 +4554,9 @@ static int read_metadata_strings(struct tracecmd_input *handle)
529 unsigned short id;
530 unsigned int csize, rsize;
531 unsigned long long size;
532- off64_t offset;
533+ off_t offset;
534
535- offset = lseek64(handle->fd, 0, SEEK_CUR);
536+ offset = lseek(handle->fd, 0, SEEK_CUR);
537 do {
538 if (read_section_header(handle, &id, &flags, &size, NULL))
539 break;
540@@ -4575,12 +4575,12 @@ static int read_metadata_strings(struct tracecmd_input *handle)
541 if (flags & TRACECMD_SEC_FL_COMPRESS)
542 in_uncompress_reset(handle);
543 } else {
544- if (lseek64(handle->fd, size, SEEK_CUR) == (off_t)-1)
545+ if (lseek(handle->fd, size, SEEK_CUR) == (off_t)-1)
546 break;
547 }
548 } while (1);
549
550- if (lseek64(handle->fd, offset, SEEK_SET) == (off_t)-1)
551+ if (lseek(handle->fd, offset, SEEK_SET) == (off_t)-1)
552 return -1;
553
554 return found ? 0 : -1;
555@@ -4683,9 +4683,9 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd, int flags)
556 handle->page_size = page_size;
557 handle->next_offset = page_size;
558
559- offset = lseek64(handle->fd, 0, SEEK_CUR);
560- handle->total_file_size = lseek64(handle->fd, 0, SEEK_END);
561- lseek64(handle->fd, offset, SEEK_SET);
562+ offset = lseek(handle->fd, 0, SEEK_CUR);
563+ handle->total_file_size = lseek(handle->fd, 0, SEEK_END);
564+ lseek(handle->fd, offset, SEEK_SET);
565
566 if (HAS_COMPRESSION(handle)) {
567 zname = read_string(handle);
568@@ -5533,7 +5533,7 @@ static int copy_options_recursive(struct tracecmd_input *in_handle,
569 if (!next)
570 break;
571
572- if (do_lseek(in_handle, next, SEEK_SET) == (off64_t)-1)
573+ if (do_lseek(in_handle, next, SEEK_SET) == (off_t)-1)
574 return -1;
575
576 if (read_section_header(in_handle, &id, &flags, NULL, NULL))
577@@ -5648,7 +5648,7 @@ int tracecmd_copy_options(struct tracecmd_input *in_handle,
578 if (!in_handle->options_start)
579 return 0;
580
581- if (lseek64(in_handle->fd, in_handle->options_start, SEEK_SET) == (off64_t)-1)
582+ if (lseek(in_handle->fd, in_handle->options_start, SEEK_SET) == (off_t)-1)
583 return -1;
584
585 if (copy_options(in_handle, out_handle) < 0)
586@@ -5980,10 +5980,10 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx)
587 new_handle->pid_maps = NULL;
588 if (!HAS_SECTIONS(handle)) {
589 /* Save where we currently are */
590- offset = lseek64(handle->fd, 0, SEEK_CUR);
591+ offset = lseek(handle->fd, 0, SEEK_CUR);
592
593- ret = lseek64(handle->fd, buffer->offset, SEEK_SET);
594- if (ret == (off64_t)-1) {
595+ ret = lseek(handle->fd, buffer->offset, SEEK_SET);
596+ if (ret == (off_t)-1) {
597 tracecmd_warning("could not seek to buffer %s offset %ld",
598 buffer->name, buffer->offset);
599 goto error;
600@@ -6001,7 +6001,7 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx)
601 tracecmd_warning("failed to read sub buffer %s", buffer->name);
602 goto error;
603 }
604- ret = lseek64(handle->fd, offset, SEEK_SET);
605+ ret = lseek(handle->fd, offset, SEEK_SET);
606 if (ret < 0) {
607 tracecmd_warning("could not seek to back to offset %ld", offset);
608 goto error;
609@@ -6171,13 +6171,13 @@ const char *tracecmd_get_version(struct tracecmd_input *handle)
610 *
611 * Provides a method to extract the cpu file size saved in @handle.
612 *
613- * Returns the cpu file size saved in trace.dat file or (off64_t)-1 for
614+ * Returns the cpu file size saved in trace.dat file or (off_t)-1 for
615 * invalid cpu index.
616 */
617-off64_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu)
618+off_t tracecmd_get_cpu_file_size(struct tracecmd_input *handle, int cpu)
619 {
620 if (cpu < 0 || cpu >= handle->cpus)
621- return (off64_t)-1;
622+ return (off_t)-1;
623 return handle->cpu_data[cpu].file_size;
624 }
625
626diff --git a/lib/trace-cmd/trace-msg.c b/lib/trace-cmd/trace-msg.c
627index 0b2de710..3a555c36 100644
628--- a/lib/trace-cmd/trace-msg.c
629+++ b/lib/trace-cmd/trace-msg.c
630@@ -183,26 +183,26 @@ static int __msg_write(int fd, struct tracecmd_msg *msg, bool network)
631 return __do_write_check(fd, msg->buf, data_size);
632 }
633
634-__hidden off64_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off64_t offset, int whence)
635+__hidden off_t msg_lseek(struct tracecmd_msg_handle *msg_handle, off_t offset, int whence)
636 {
637- off64_t cache_offset = msg_handle->cache_start_offset;
638- off64_t ret;
639+ off_t cache_offset = msg_handle->cache_start_offset;
640+ off_t ret;
641
642 /*
643 * lseek works only if the handle is in cache mode,
644 * cannot seek on a network socket
645 */
646 if (!msg_handle->cache || msg_handle->cfd < 0)
647- return (off64_t)-1;
648+ return (off_t)-1;
649
650 if (whence == SEEK_SET) {
651 if (offset < cache_offset)
652- return (off64_t)-1;
653+ return (off_t)-1;
654 offset -= cache_offset;
655 }
656
657- ret = lseek64(msg_handle->cfd, offset, whence);
658- if (ret == (off64_t)-1)
659+ ret = lseek(msg_handle->cfd, offset, whence);
660+ if (ret == (off_t)-1)
661 return ret;
662
663 return ret + cache_offset;
664@@ -639,7 +639,7 @@ static int flush_cache(struct tracecmd_msg_handle *msg_handle)
665 if (!msg_handle->cache || fd < 0)
666 return 0;
667 msg_handle->cache = false;
668- if (lseek64(fd, 0, SEEK_SET) == (off64_t)-1)
669+ if (lseek(fd, 0, SEEK_SET) == (off_t)-1)
670 return -1;
671 do {
672 ret = read(fd, buf, MSG_MAX_DATA_LEN);
673@@ -650,8 +650,8 @@ static int flush_cache(struct tracecmd_msg_handle *msg_handle)
674 break;
675 } while (ret >= 0);
676
677- msg_handle->cache_start_offset = lseek64(fd, 0, SEEK_CUR);
678- if (msg_handle->cache_start_offset == (off64_t)-1)
679+ msg_handle->cache_start_offset = lseek(fd, 0, SEEK_CUR);
680+ if (msg_handle->cache_start_offset == (off_t)-1)
681 return -1;
682
683 close(fd);
684diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600685index 1c0f7b77..ad740d65 100644
Andrew Geissler517393d2023-01-13 08:55:19 -0600686--- a/lib/trace-cmd/trace-output.c
687+++ b/lib/trace-cmd/trace-output.c
688@@ -112,7 +112,7 @@ do_write_check(struct tracecmd_output *handle, const void *data, long long size)
689 return __do_write_check(handle->fd, data, size);
690 }
691
692-static inline off64_t do_lseek(struct tracecmd_output *handle, off_t offset, int whence)
693+static inline off_t do_lseek(struct tracecmd_output *handle, off_t offset, int whence)
694 {
695 if (handle->do_compress)
696 return tracecmd_compress_lseek(handle->compress, offset, whence);
697@@ -120,7 +120,7 @@ static inline off64_t do_lseek(struct tracecmd_output *handle, off_t offset, int
698 if (handle->msg_handle)
699 return msg_lseek(handle->msg_handle, offset, whence);
700
701- return lseek64(handle->fd, offset, whence);
702+ return lseek(handle->fd, offset, whence);
703 }
704
705 static inline int do_preed(struct tracecmd_output *handle, void *dst, int len, off_t offset)
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600706@@ -526,12 +526,12 @@ out_write_section_header(struct tracecmd_output *handle, unsigned short header_i
Andrew Geissler517393d2023-01-13 08:55:19 -0600707 /* Section ID */
708 endian2 = convert_endian_2(handle, header_id);
709 if (do_write_check(handle, &endian2, 2))
710- return (off64_t)-1;
711+ return (off_t)-1;
712
713 /* Section flags */
714 endian2 = convert_endian_2(handle, flags);
715 if (do_write_check(handle, &endian2, 2))
716- return (off64_t)-1;
717+ return (off_t)-1;
718
719 /* Section description */
720 if (description)
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600721@@ -540,13 +540,13 @@ out_write_section_header(struct tracecmd_output *handle, unsigned short header_i
Andrew Geissler517393d2023-01-13 08:55:19 -0600722 desc = -1;
723 endian4 = convert_endian_4(handle, desc);
724 if (do_write_check(handle, &endian4, 4))
725- return (off64_t)-1;
726+ return (off_t)-1;
727
728 offset = do_lseek(handle, 0, SEEK_CUR);
729 size = 0;
730 /* Reserve for section size */
731 if (do_write_check(handle, &size, 8))
732- return (off64_t)-1;
733+ return (off_t)-1;
734 return offset;
735 }
736
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600737@@ -567,13 +567,13 @@ __hidden int out_update_section_header(struct tracecmd_output *handle, tsize_t o
Andrew Geissler517393d2023-01-13 08:55:19 -0600738 if (size < 8)
739 return -1;
740 size -= 8;
741- if (do_lseek(handle, offset, SEEK_SET) == (off64_t)-1)
742+ if (do_lseek(handle, offset, SEEK_SET) == (off_t)-1)
743 return -1;
744
745 endian8 = convert_endian_8(handle, size);
746 if (do_write_check(handle, &endian8, 8))
747 return -1;
748- if (do_lseek(handle, current, SEEK_SET) == (off64_t)-1)
749+ if (do_lseek(handle, current, SEEK_SET) == (off_t)-1)
750 return -1;
751 return 0;
752 }
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600753@@ -595,7 +595,7 @@ static int save_string_section(struct tracecmd_output *handle, bool compress)
Andrew Geissler517393d2023-01-13 08:55:19 -0600754 if (compress)
755 flags |= TRACECMD_SEC_FL_COMPRESS;
756 offset = out_write_section_header(handle, TRACECMD_OPTION_STRINGS, "strings", flags, false);
757- if (offset == (off64_t)-1)
758+ if (offset == (off_t)-1)
759 return -1;
760
761 out_compression_start(handle, compress);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600762@@ -645,7 +645,7 @@ static int read_header_files(struct tracecmd_output *handle, bool compress)
Andrew Geissler517393d2023-01-13 08:55:19 -0600763 flags |= TRACECMD_SEC_FL_COMPRESS;
764 offset = out_write_section_header(handle, TRACECMD_OPTION_HEADER_INFO,
765 "headers", flags, true);
766- if (offset == (off64_t)-1)
767+ if (offset == (off_t)-1)
768 return -1;
769
770 out_compression_start(handle, compress);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600771@@ -973,7 +973,7 @@ static int read_ftrace_files(struct tracecmd_output *handle, bool compress)
Andrew Geissler517393d2023-01-13 08:55:19 -0600772 flags |= TRACECMD_SEC_FL_COMPRESS;
773 offset = out_write_section_header(handle, TRACECMD_OPTION_FTRACE_EVENTS,
774 "ftrace events", flags, true);
775- if (offset == (off64_t)-1)
776+ if (offset == (off_t)-1)
777 return -1;
778
779 create_event_list_item(handle, &systems, &list);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600780@@ -1032,7 +1032,7 @@ static int read_event_files(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600781 flags |= TRACECMD_SEC_FL_COMPRESS;
782 offset = out_write_section_header(handle, TRACECMD_OPTION_EVENT_FORMATS,
783 "events format", flags, true);
784- if (offset == (off64_t)-1)
785+ if (offset == (off_t)-1)
786 return -1;
787 /*
788 * If any of the list is the special keyword "all" then
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600789@@ -1146,7 +1146,7 @@ static int read_proc_kallsyms(struct tracecmd_output *handle, bool compress)
Andrew Geissler517393d2023-01-13 08:55:19 -0600790 flags |= TRACECMD_SEC_FL_COMPRESS;
791 offset = out_write_section_header(handle, TRACECMD_OPTION_KALLSYMS,
792 "kallsyms", flags, true);
793- if (offset == (off64_t)-1)
794+ if (offset == (off_t)-1)
795 return -1;
796
797 out_compression_start(handle, compress);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600798@@ -1210,7 +1210,7 @@ static int read_ftrace_printk(struct tracecmd_output *handle, bool compress)
Andrew Geissler517393d2023-01-13 08:55:19 -0600799 if (compress)
800 flags |= TRACECMD_SEC_FL_COMPRESS;
801 offset = out_write_section_header(handle, TRACECMD_OPTION_PRINTK, "printk", flags, true);
802- if (offset == (off64_t)-1)
803+ if (offset == (off_t)-1)
804 return -1;
805
806 out_compression_start(handle, compress);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600807@@ -1255,8 +1255,8 @@ static int save_tracing_file_data(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600808 unsigned long long endian8;
809 char *file = NULL;
810 struct stat st;
811- off64_t check_size;
812- off64_t size;
813+ off_t check_size;
814+ off_t size;
815 int ret = -1;
816
817 file = get_tracing_file(handle, filename);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600818@@ -1850,9 +1850,9 @@ static int write_options_v6(struct tracecmd_output *handle)
Andrew Geissler517393d2023-01-13 08:55:19 -0600819 return 0;
820 }
821
822-static int update_options_start(struct tracecmd_output *handle, off64_t offset)
823+static int update_options_start(struct tracecmd_output *handle, off_t offset)
824 {
825- if (do_lseek(handle, handle->options_start, SEEK_SET) == (off64_t)-1)
826+ if (do_lseek(handle, handle->options_start, SEEK_SET) == (off_t)-1)
827 return -1;
828 offset = convert_endian_8(handle, offset);
829 if (do_write_check(handle, &offset, 8))
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600830@@ -1875,7 +1875,7 @@ static int update_options_start(struct tracecmd_output *handle, off64_t offset)
Andrew Geissler517393d2023-01-13 08:55:19 -0600831 *
832 * Returns zero on success and -1 on error.
833 */
834-int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int whence)
835+int tracecmd_prepare_options(struct tracecmd_output *handle, off_t offset, int whence)
836 {
837 tsize_t curr;
838 int ret;
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600839@@ -1895,7 +1895,7 @@ int tracecmd_prepare_options(struct tracecmd_output *handle, off64_t offset, int
Andrew Geissler517393d2023-01-13 08:55:19 -0600840 break;
841 case SEEK_END:
842 offset = do_lseek(handle, offset, SEEK_END);
843- if (offset == (off64_t)-1)
844+ if (offset == (off_t)-1)
845 return -1;
846 break;
847 }
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600848@@ -2067,7 +2067,7 @@ __hidden void *trace_get_options(struct tracecmd_output *handle, size_t *len)
Andrew Geissler517393d2023-01-13 08:55:19 -0600849 if (!buf)
850 goto out;
851
852- if (do_lseek(&out_handle, 0, SEEK_SET) == (off64_t)-1)
853+ if (do_lseek(&out_handle, 0, SEEK_SET) == (off_t)-1)
854 goto out;
855 *len = read(msg_handle.cfd, buf, offset);
856 if (*len != offset) {
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600857@@ -2278,7 +2278,7 @@ int tracecmd_write_cmdlines(struct tracecmd_output *handle)
Andrew Geissler517393d2023-01-13 08:55:19 -0600858 flags |= TRACECMD_SEC_FL_COMPRESS;
859 offset = out_write_section_header(handle, TRACECMD_OPTION_CMDLINES,
860 "command lines", flags, true);
861- if (offset == (off64_t)-1)
862+ if (offset == (off_t)-1)
863 return -1;
864
865 out_compression_start(handle, compress);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600866@@ -2527,7 +2527,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600867 current = do_lseek(handle, 0, SEEK_CUR);
868
869 /* Go to the option data, where will write the offest */
870- if (do_lseek(handle, b_offset, SEEK_SET) == (off64_t)-1) {
871+ if (do_lseek(handle, b_offset, SEEK_SET) == (off_t)-1) {
872 tracecmd_warning("could not seek to %lld", b_offset);
873 return -1;
874 }
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600875@@ -2536,7 +2536,7 @@ static int update_buffer_cpu_offset_v6(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600876 return -1;
877
878 /* Go back to end of file */
879- if (do_lseek(handle, current, SEEK_SET) == (off64_t)-1) {
880+ if (do_lseek(handle, current, SEEK_SET) == (off_t)-1) {
881 tracecmd_warning("could not seek to %lld", offset);
882 return -1;
883 }
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600884@@ -2660,7 +2660,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600885 data_files[i].data_offset &= ~(page_size - 1);
886
887 ret = do_lseek(handle, data_files[i].data_offset, SEEK_SET);
888- if (ret == (off64_t)-1)
889+ if (ret == (off_t)-1)
890 goto out_free;
891
892 if (!tracecmd_get_quiet(handle))
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600893@@ -2668,7 +2668,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600894 i, (unsigned long long)data_files[i].data_offset);
895
896 if (data[i].size) {
897- if (lseek64(data[i].fd, data[i].offset, SEEK_SET) == (off64_t)-1)
898+ if (lseek(data[i].fd, data[i].offset, SEEK_SET) == (off_t)-1)
899 goto out_free;
900 read_size = out_copy_fd_compress(handle, data[i].fd,
901 data[i].size, &data_files[i].write_size,
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600902@@ -2686,19 +2686,19 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600903
904 if (!HAS_SECTIONS(handle)) {
905 /* Write the real CPU data offset in the file */
906- if (do_lseek(handle, data_files[i].file_data_offset, SEEK_SET) == (off64_t)-1)
907+ if (do_lseek(handle, data_files[i].file_data_offset, SEEK_SET) == (off_t)-1)
908 goto out_free;
909 endian8 = convert_endian_8(handle, data_files[i].data_offset);
910 if (do_write_check(handle, &endian8, 8))
911 goto out_free;
912 /* Write the real CPU data size in the file */
913- if (do_lseek(handle, data_files[i].file_write_size, SEEK_SET) == (off64_t)-1)
914+ if (do_lseek(handle, data_files[i].file_write_size, SEEK_SET) == (off_t)-1)
915 goto out_free;
916 endian8 = convert_endian_8(handle, data_files[i].write_size);
917 if (do_write_check(handle, &endian8, 8))
918 goto out_free;
919 offset = data_files[i].data_offset + data_files[i].write_size;
920- if (do_lseek(handle, offset, SEEK_SET) == (off64_t)-1)
921+ if (do_lseek(handle, offset, SEEK_SET) == (off_t)-1)
922 goto out_free;
923 }
924 if (!tracecmd_get_quiet(handle)) {
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600925@@ -2717,7 +2717,7 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
Andrew Geissler517393d2023-01-13 08:55:19 -0600926 goto out_free;
927
928 free(data_files);
929- if (do_lseek(handle, 0, SEEK_END) == (off64_t)-1)
930+ if (do_lseek(handle, 0, SEEK_END) == (off_t)-1)
931 return -1;
932
933 if (out_update_section_header(handle, offset))
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600934@@ -2986,7 +2986,7 @@ __hidden int out_save_options_offset(struct tracecmd_output *handle, unsigned lo
Andrew Geissler517393d2023-01-13 08:55:19 -0600935 return -1;
936
937 new = do_lseek(handle, 0, SEEK_CUR);
938- if (do_lseek(handle, handle->options_start, SEEK_SET) == (off64_t)-1)
939+ if (do_lseek(handle, handle->options_start, SEEK_SET) == (off_t)-1)
940 return -1;
941
942 en8 = convert_endian_8(handle, start);
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600943@@ -2994,7 +2994,7 @@ __hidden int out_save_options_offset(struct tracecmd_output *handle, unsigned lo
Andrew Geissler517393d2023-01-13 08:55:19 -0600944 return -1;
945
946 handle->options_start = new;
947- if (do_lseek(handle, new, SEEK_SET) == (off64_t)-1)
948+ if (do_lseek(handle, new, SEEK_SET) == (off_t)-1)
949 return -1;
950 } else {
951 handle->options_start = start;
952diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600953index 23499f30..c172ad64 100644
Andrew Geissler517393d2023-01-13 08:55:19 -0600954--- a/lib/trace-cmd/trace-recorder.c
955+++ b/lib/trace-cmd/trace-recorder.c
956@@ -51,7 +51,7 @@ static int append_file(int size, int dst, int src)
957 char buf[size];
958 int r;
959
960- lseek64(src, 0, SEEK_SET);
961+ lseek(src, 0, SEEK_SET);
962
963 /* If there's an error, then we are pretty much screwed :-p */
964 do {
965@@ -82,10 +82,10 @@ void tracecmd_free_recorder(struct tracecmd_recorder *recorder)
966 recorder->fd2, recorder->fd1);
967 /* Error on copying, then just keep fd1 */
968 if (ret) {
969- lseek64(recorder->fd1, 0, SEEK_END);
970+ lseek(recorder->fd1, 0, SEEK_END);
971 goto close;
972 }
973- lseek64(recorder->fd1, 0, SEEK_SET);
974+ lseek(recorder->fd1, 0, SEEK_SET);
975 ftruncate(recorder->fd1, 0);
976 }
977 append_file(recorder->page_size, recorder->fd1, recorder->fd2);
978@@ -305,7 +305,7 @@ static inline void update_fd(struct tracecmd_recorder *recorder, int size)
979 fd = recorder->fd1;
980
981 /* Zero out the new file we are writing to */
982- lseek64(fd, 0, SEEK_SET);
983+ lseek(fd, 0, SEEK_SET);
984 ftruncate(fd, 0);
985
986 recorder->fd = fd;
987diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
988index 22e3d871..11c1baf1 100644
989--- a/tracecmd/trace-dump.c
990+++ b/tracecmd/trace-dump.c
991@@ -101,7 +101,7 @@ static int do_lseek(int fd, int offset, int whence)
992 if (read_compress)
993 return tracecmd_compress_lseek(compress, offset, whence);
994
995- return lseek64(fd, offset, whence);
996+ return lseek(fd, offset, whence);
997 }
998
999 static int read_file_string(int fd, char *dst, int len)
1000@@ -446,7 +446,7 @@ static void dump_section_header(int fd, enum dump_items v, unsigned short *flags
1001 const char *desc;
1002 int desc_id;
1003
1004- offset = lseek64(fd, 0, SEEK_CUR);
1005+ offset = lseek(fd, 0, SEEK_CUR);
1006 if (read_file_number(fd, &id, 2))
1007 die("cannot read the section id");
1008
1009@@ -500,13 +500,13 @@ static void dump_option_buffer(int fd, unsigned short option, int size)
1010 return;
1011 }
1012
1013- current = lseek64(fd, 0, SEEK_CUR);
1014- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
1015+ current = lseek(fd, 0, SEEK_CUR);
1016+ if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
1017 die("cannot goto buffer offset %lld", offset);
1018
1019 dump_section_header(fd, FLYRECORD, &flags);
1020
1021- if (lseek64(fd, current, SEEK_SET) == (off_t)-1)
1022+ if (lseek(fd, current, SEEK_SET) == (off_t)-1)
1023 die("cannot go back to buffer option");
1024
1025 do_print(OPTIONS|FLYRECORD, "\t\t[Option BUFFER, %d bytes]\n", size);
1026@@ -773,7 +773,7 @@ static void dump_sections(int fd, int count)
1027 unsigned short flags;
1028
1029 while (sec) {
1030- if (lseek64(fd, sec->offset, SEEK_SET) == (off_t)-1)
1031+ if (lseek(fd, sec->offset, SEEK_SET) == (off_t)-1)
1032 die("cannot goto option offset %lld", sec->offset);
1033
1034 dump_section_header(fd, sec->verbosity, &flags);
1035@@ -826,7 +826,7 @@ static int dump_option_done(int fd, int size)
1036 if (!offset)
1037 return 0;
1038
1039- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
1040+ if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
1041 die("cannot goto next options offset %lld", offset);
1042
1043 do_print(OPTIONS, "\n\n");
1044@@ -1006,7 +1006,7 @@ static void dump_therest(int fd)
1045 else if (strncmp(str, HEAD_FLYRECORD, 10) == 0)
1046 dump_flyrecord(fd);
1047 else {
1048- lseek64(fd, -10, SEEK_CUR);
1049+ lseek(fd, -10, SEEK_CUR);
1050 break;
1051 }
1052 }
1053@@ -1060,7 +1060,7 @@ static void get_meta_strings(int fd)
1054 unsigned short fl, id;
1055 int desc_id;
1056
1057- offset = lseek64(fd, 0, SEEK_CUR);
1058+ offset = lseek(fd, 0, SEEK_CUR);
1059 do {
1060 if (read_file_number(fd, &id, 2))
1061 break;
1062@@ -1074,7 +1074,7 @@ static void get_meta_strings(int fd)
1063 if ((fl & TRACECMD_SEC_FL_COMPRESS)) {
1064 read_file_number(fd, &csize, 4);
1065 read_file_number(fd, &rsize, 4);
1066- lseek64(fd, -8, SEEK_CUR);
1067+ lseek(fd, -8, SEEK_CUR);
1068 if (uncompress_block())
1069 break;
1070 } else {
1071@@ -1083,12 +1083,12 @@ static void get_meta_strings(int fd)
1072 read_metadata_strings(fd, rsize);
1073 uncompress_reset();
1074 } else {
1075- if (lseek64(fd, size, SEEK_CUR) == (off_t)-1)
1076+ if (lseek(fd, size, SEEK_CUR) == (off_t)-1)
1077 break;
1078 }
1079 } while (1);
1080
1081- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
1082+ if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
1083 die("cannot restore the original file location");
1084 }
1085
1086@@ -1102,9 +1102,9 @@ static int walk_v7_sections(int fd)
1087 int desc_id;
1088 const char *desc;
1089
1090- offset = lseek64(fd, 0, SEEK_CUR);
1091+ offset = lseek(fd, 0, SEEK_CUR);
1092 do {
1093- soffset = lseek64(fd, 0, SEEK_CUR);
1094+ soffset = lseek(fd, 0, SEEK_CUR);
1095 if (read_file_number(fd, &id, 2))
1096 break;
1097
1098@@ -1149,11 +1149,11 @@ static int walk_v7_sections(int fd)
1099 id, soffset, desc, fl, size);
1100 }
1101
1102- if (lseek64(fd, size, SEEK_CUR) == (off_t)-1)
1103+ if (lseek(fd, size, SEEK_CUR) == (off_t)-1)
1104 break;
1105 } while (1);
1106
1107- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
1108+ if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
1109 die("cannot restore the original file location");
1110
1111 return count;
1112@@ -1170,7 +1170,7 @@ static void dump_v7_file(int fd)
1113 get_meta_strings(fd);
1114 sections = walk_v7_sections(fd);
1115
1116- if (lseek64(fd, offset, SEEK_SET) == (off_t)-1)
1117+ if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
1118 die("cannot goto options offset %lld", offset);
1119
1120 dump_options(fd);
1121diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
1122index 224a6dde..c094ad6a 100644
1123--- a/tracecmd/trace-read.c
1124+++ b/tracecmd/trace-read.c
1125@@ -195,7 +195,7 @@ static void print_event(struct trace_seq *s, struct tracecmd_input *handle,
1126 #define TEST_READ_AT 0
1127 #if TEST_READ_AT
1128 #define DO_TEST
1129-static off64_t test_read_at_offset;
1130+static off_t test_read_at_offset;
1131 static int test_read_at_copy = 100;
1132 static int test_read_at_index;
1133 static void show_test(struct tracecmd_input *handle)
1134--
11352.39.0
1136