diff mbox series

[2/2] libtracefs: Have tracefs_cpu_stop() always suggesting nudging

Message ID 20230105215252.224044-3-rostedt@goodmis.org (mailing list archive)
State Deferred
Headers show
Series libtracefs: Fixups to tracefs_cpu_stop() | expand

Commit Message

Steven Rostedt Jan. 5, 2023, 9:52 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The man page of tracefs_cpu_stop() states that if it returns 0 that it
guaranteed to wake up a reader. Well, that doesn't appear to always be the
case. Return 1 until we can figure it out.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-record.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Steven Rostedt Jan. 6, 2023, 4:11 a.m. UTC | #1
On Thu,  5 Jan 2023 16:52:52 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The man page of tracefs_cpu_stop() states that if it returns 0 that it
> guaranteed to wake up a reader. Well, that doesn't appear to always be the
> case. Return 1 until we can figure it out.
> 

Hmm, I got my application working again without this change.

I'll hold off from applying it. Perhaps it was the application fault and
not the library.

-- Steve

> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  src/tracefs-record.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/src/tracefs-record.c b/src/tracefs-record.c
> index f998883134b8..9baec6780974 100644
> --- a/src/tracefs-record.c
> +++ b/src/tracefs-record.c
> @@ -429,15 +429,11 @@ int tracefs_cpu_stop(struct tracefs_cpu *tcpu)
>  		return ret;
>  
>  	/* Calling ioctl() on recent kernels will wake up the waiters */
> -	ret = ioctl(tcpu->fd, 0);
> -	if (ret < 0)
> -		ret = 1;
> -	else
> -		ret = 0;
> +	ioctl(tcpu->fd, 0);
>  
>  	set_nonblock(tcpu);
>  
> -	return ret;
> +	return 1;
>  }
>  
>  /**
diff mbox series

Patch

diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index f998883134b8..9baec6780974 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -429,15 +429,11 @@  int tracefs_cpu_stop(struct tracefs_cpu *tcpu)
 		return ret;
 
 	/* Calling ioctl() on recent kernels will wake up the waiters */
-	ret = ioctl(tcpu->fd, 0);
-	if (ret < 0)
-		ret = 1;
-	else
-		ret = 0;
+	ioctl(tcpu->fd, 0);
 
 	set_nonblock(tcpu);
 
-	return ret;
+	return 1;
 }
 
 /**