* [PATCH] trace-cmd: Use lseek64 and off64_t in tracecmd_append_cpu_data().
@ 2010-09-11 1:24 David Sharp
2010-09-13 16:10 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: David Sharp @ 2010-09-11 1:24 UTC (permalink / raw)
To: rostedt; +Cc: mrubin, linux-kernel, David Sharp
lseek64 returns 64-bit, but was being truncated to int. Large offsets would
cause the subsequent error checking to fail spuriously, leaving behind a bad
trace.dat and a collection of trace.dat.cpuX files.
---
trace-output.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/trace-output.c b/trace-output.c
index 89b3954..0730a1e 100644
--- a/trace-output.c
+++ b/trace-output.c
@@ -705,9 +705,9 @@ out_free:
int tracecmd_append_cpu_data(struct tracecmd_output *handle,
int cpus, char * const *cpu_data_files)
{
- unsigned long long *offsets = NULL;
+ off64_t *offsets = NULL;
unsigned long long *sizes = NULL;
- unsigned long long offset;
+ off64_t offset;
unsigned long long endian8;
off64_t check_size;
char *file;
@@ -733,7 +733,7 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle,
if (!sizes)
goto out_free;
- offset = lseek(handle->fd, 0, SEEK_CUR);
+ offset = lseek64(handle->fd, 0, SEEK_CUR);
/* hold any extra data for data */
offset += cpus * (16);
@@ -761,8 +761,8 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle,
for (i = 0; i < cpus; i++) {
fprintf(stderr, "offset=%llx\n", offsets[i]);
- ret = lseek64(handle->fd, offsets[i], SEEK_SET);
- if (ret < 0) {
+ offset = lseek64(handle->fd, offsets[i], SEEK_SET);
+ if (offset == (off64_t)-1) {
warning("could not seek to %lld\n", offsets[i]);
goto out_free;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] trace-cmd: Use lseek64 and off64_t in tracecmd_append_cpu_data().
2010-09-11 1:24 [PATCH] trace-cmd: Use lseek64 and off64_t in tracecmd_append_cpu_data() David Sharp
@ 2010-09-13 16:10 ` Steven Rostedt
2010-09-13 20:54 ` David Sharp
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2010-09-13 16:10 UTC (permalink / raw)
To: David Sharp; +Cc: mrubin, linux-kernel
Hi David,
On Fri, 2010-09-10 at 18:24 -0700, David Sharp wrote:
> lseek64 returns 64-bit, but was being truncated to int. Large offsets would
> cause the subsequent error checking to fail spuriously, leaving behind a bad
> trace.dat and a collection of trace.dat.cpuX files.
Could you resend with your SoB.
Thanks!
-- Steve
> ---
> trace-output.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/trace-output.c b/trace-output.c
> index 89b3954..0730a1e 100644
> --- a/trace-output.c
> +++ b/trace-output.c
> @@ -705,9 +705,9 @@ out_free:
> int tracecmd_append_cpu_data(struct tracecmd_output *handle,
> int cpus, char * const *cpu_data_files)
> {
> - unsigned long long *offsets = NULL;
> + off64_t *offsets = NULL;
> unsigned long long *sizes = NULL;
> - unsigned long long offset;
> + off64_t offset;
> unsigned long long endian8;
> off64_t check_size;
> char *file;
> @@ -733,7 +733,7 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle,
> if (!sizes)
> goto out_free;
>
> - offset = lseek(handle->fd, 0, SEEK_CUR);
> + offset = lseek64(handle->fd, 0, SEEK_CUR);
>
> /* hold any extra data for data */
> offset += cpus * (16);
> @@ -761,8 +761,8 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle,
>
> for (i = 0; i < cpus; i++) {
> fprintf(stderr, "offset=%llx\n", offsets[i]);
> - ret = lseek64(handle->fd, offsets[i], SEEK_SET);
> - if (ret < 0) {
> + offset = lseek64(handle->fd, offsets[i], SEEK_SET);
> + if (offset == (off64_t)-1) {
> warning("could not seek to %lld\n", offsets[i]);
> goto out_free;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] trace-cmd: Use lseek64 and off64_t in tracecmd_append_cpu_data().
2010-09-13 16:10 ` Steven Rostedt
@ 2010-09-13 20:54 ` David Sharp
0 siblings, 0 replies; 3+ messages in thread
From: David Sharp @ 2010-09-13 20:54 UTC (permalink / raw)
To: rostedt; +Cc: mrubin, linux-kernel, David Sharp
lseek64 returns 64-bit, but was being truncated to int. Large offsets would
cause the subsequent error checking to fail spuriously, leaving behind a bad
trace.dat and a collection of trace.dat.cpuX files.
Signed-off-by: David Sharp <dhsharp@google.com>
---
trace-output.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/trace-output.c b/trace-output.c
index 89b3954..0730a1e 100644
--- a/trace-output.c
+++ b/trace-output.c
@@ -705,9 +705,9 @@ out_free:
int tracecmd_append_cpu_data(struct tracecmd_output *handle,
int cpus, char * const *cpu_data_files)
{
- unsigned long long *offsets = NULL;
+ off64_t *offsets = NULL;
unsigned long long *sizes = NULL;
- unsigned long long offset;
+ off64_t offset;
unsigned long long endian8;
off64_t check_size;
char *file;
@@ -733,7 +733,7 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle,
if (!sizes)
goto out_free;
- offset = lseek(handle->fd, 0, SEEK_CUR);
+ offset = lseek64(handle->fd, 0, SEEK_CUR);
/* hold any extra data for data */
offset += cpus * (16);
@@ -761,8 +761,8 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle,
for (i = 0; i < cpus; i++) {
fprintf(stderr, "offset=%llx\n", offsets[i]);
- ret = lseek64(handle->fd, offsets[i], SEEK_SET);
- if (ret < 0) {
+ offset = lseek64(handle->fd, offsets[i], SEEK_SET);
+ if (offset == (off64_t)-1) {
warning("could not seek to %lld\n", offsets[i]);
goto out_free;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-13 20:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-11 1:24 [PATCH] trace-cmd: Use lseek64 and off64_t in tracecmd_append_cpu_data() David Sharp
2010-09-13 16:10 ` Steven Rostedt
2010-09-13 20:54 ` David Sharp
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.