Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] [PATCH] Fix I/O-related error values in ustctl
@ 2013-01-21 15:21 Mathieu Desnoyers
  2013-01-21 15:54 ` David Goulet
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Desnoyers @ 2013-01-21 15:21 UTC (permalink / raw)


These internal ustctl API members document >=0 as OK values. Make sure
reply recv errors are returned as errors.

Clarify ustctl_create_stream() error values.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h
index c2b255c..11beaba 100644
--- a/include/lttng/ust-ctl.h
+++ b/include/lttng/ust-ctl.h
@@ -23,7 +23,7 @@
 
 /*
  * Error values: all the following functions return:
- * >= 0: Sucess (LTTNG_UST_OK)
+ * >= 0: Success (LTTNG_UST_OK)
  * < 0: error code.
  */
 int ustctl_register_done(int sock);
@@ -34,8 +34,6 @@ int ustctl_open_metadata(int sock, int session_handle,
 int ustctl_create_channel(int sock, int session_handle,
 		struct lttng_ust_channel_attr *chops,
 		struct lttng_ust_object_data **channel_data);
-int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
-		struct lttng_ust_object_data **stream_data);
 int ustctl_create_event(int sock, struct lttng_ust_event *ev,
 		struct lttng_ust_object_data *channel_data,
 		struct lttng_ust_object_data **event_data);
@@ -51,6 +49,15 @@ int ustctl_start_session(int sock, int handle);
 int ustctl_stop_session(int sock, int handle);
 
 /*
+ * Return -ENOENT if no more stream is available for creation.
+ * Return 0 on success.
+ * Return negative error value on system error.
+ * Return positive error value on UST error.
+ */
+int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
+		struct lttng_ust_object_data **stream_data);
+
+/*
  * ustctl_tracepoint_list returns a tracepoint list handle, or negative
  * error value.
  */
diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c
index 9a67ea1..db9910d 100644
--- a/liblttng-ust-comm/lttng-ust-comm.c
+++ b/liblttng-ust-comm/lttng-ust-comm.c
@@ -435,7 +435,10 @@ int ustcomm_send_app_cmd(int sock,
 	ret = ustcomm_send_app_msg(sock, lum);
 	if (ret)
 		return ret;
-	return ustcomm_recv_app_reply(sock, lur, lum->handle, lum->cmd);
+	ret = ustcomm_recv_app_reply(sock, lur, lum->handle, lum->cmd);
+	if (ret > 0)
+		return -EIO;
+	return ret;
 }
 
 /*

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [lttng-dev] [PATCH] Fix I/O-related error values in ustctl
  2013-01-21 15:21 [lttng-dev] [PATCH] Fix I/O-related error values in ustctl Mathieu Desnoyers
@ 2013-01-21 15:54 ` David Goulet
  2013-01-21 15:58   ` Mathieu Desnoyers
  0 siblings, 1 reply; 3+ messages in thread
From: David Goulet @ 2013-01-21 15:54 UTC (permalink / raw)


Acked-by: David Goulet <dgoulet at efficios.com>

Mathieu Desnoyers:
> These internal ustctl API members document >=0 as OK values. Make sure
> reply recv errors are returned as errors.
> 
> Clarify ustctl_create_stream() error values.
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h
> index c2b255c..11beaba 100644
> --- a/include/lttng/ust-ctl.h
> +++ b/include/lttng/ust-ctl.h
> @@ -23,7 +23,7 @@
>  
>  /*
>   * Error values: all the following functions return:
> - * >= 0: Sucess (LTTNG_UST_OK)
> + * >= 0: Success (LTTNG_UST_OK)
>   * < 0: error code.
>   */
>  int ustctl_register_done(int sock);
> @@ -34,8 +34,6 @@ int ustctl_open_metadata(int sock, int session_handle,
>  int ustctl_create_channel(int sock, int session_handle,
>  		struct lttng_ust_channel_attr *chops,
>  		struct lttng_ust_object_data **channel_data);
> -int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
> -		struct lttng_ust_object_data **stream_data);
>  int ustctl_create_event(int sock, struct lttng_ust_event *ev,
>  		struct lttng_ust_object_data *channel_data,
>  		struct lttng_ust_object_data **event_data);
> @@ -51,6 +49,15 @@ int ustctl_start_session(int sock, int handle);
>  int ustctl_stop_session(int sock, int handle);
>  
>  /*
> + * Return -ENOENT if no more stream is available for creation.
> + * Return 0 on success.
> + * Return negative error value on system error.
> + * Return positive error value on UST error.
> + */
> +int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
> +		struct lttng_ust_object_data **stream_data);
> +
> +/*
>   * ustctl_tracepoint_list returns a tracepoint list handle, or negative
>   * error value.
>   */
> diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c
> index 9a67ea1..db9910d 100644
> --- a/liblttng-ust-comm/lttng-ust-comm.c
> +++ b/liblttng-ust-comm/lttng-ust-comm.c
> @@ -435,7 +435,10 @@ int ustcomm_send_app_cmd(int sock,
>  	ret = ustcomm_send_app_msg(sock, lum);
>  	if (ret)
>  		return ret;
> -	return ustcomm_recv_app_reply(sock, lur, lum->handle, lum->cmd);
> +	ret = ustcomm_recv_app_reply(sock, lur, lum->handle, lum->cmd);
> +	if (ret > 0)
> +		return -EIO;
> +	return ret;
>  }
>  
>  /*
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [lttng-dev] [PATCH] Fix I/O-related error values in ustctl
  2013-01-21 15:54 ` David Goulet
@ 2013-01-21 15:58   ` Mathieu Desnoyers
  0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2013-01-21 15:58 UTC (permalink / raw)


* David Goulet (dgoulet at efficios.com) wrote:
> Acked-by: David Goulet <dgoulet at efficios.com>

merged into master branch and stable-2.1.

Thanks,

Mathieu

> 
> Mathieu Desnoyers:
> > These internal ustctl API members document >=0 as OK values. Make sure
> > reply recv errors are returned as errors.
> > 
> > Clarify ustctl_create_stream() error values.
> > 
> > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> > ---
> > diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h
> > index c2b255c..11beaba 100644
> > --- a/include/lttng/ust-ctl.h
> > +++ b/include/lttng/ust-ctl.h
> > @@ -23,7 +23,7 @@
> >  
> >  /*
> >   * Error values: all the following functions return:
> > - * >= 0: Sucess (LTTNG_UST_OK)
> > + * >= 0: Success (LTTNG_UST_OK)
> >   * < 0: error code.
> >   */
> >  int ustctl_register_done(int sock);
> > @@ -34,8 +34,6 @@ int ustctl_open_metadata(int sock, int session_handle,
> >  int ustctl_create_channel(int sock, int session_handle,
> >  		struct lttng_ust_channel_attr *chops,
> >  		struct lttng_ust_object_data **channel_data);
> > -int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
> > -		struct lttng_ust_object_data **stream_data);
> >  int ustctl_create_event(int sock, struct lttng_ust_event *ev,
> >  		struct lttng_ust_object_data *channel_data,
> >  		struct lttng_ust_object_data **event_data);
> > @@ -51,6 +49,15 @@ int ustctl_start_session(int sock, int handle);
> >  int ustctl_stop_session(int sock, int handle);
> >  
> >  /*
> > + * Return -ENOENT if no more stream is available for creation.
> > + * Return 0 on success.
> > + * Return negative error value on system error.
> > + * Return positive error value on UST error.
> > + */
> > +int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
> > +		struct lttng_ust_object_data **stream_data);
> > +
> > +/*
> >   * ustctl_tracepoint_list returns a tracepoint list handle, or negative
> >   * error value.
> >   */
> > diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c
> > index 9a67ea1..db9910d 100644
> > --- a/liblttng-ust-comm/lttng-ust-comm.c
> > +++ b/liblttng-ust-comm/lttng-ust-comm.c
> > @@ -435,7 +435,10 @@ int ustcomm_send_app_cmd(int sock,
> >  	ret = ustcomm_send_app_msg(sock, lum);
> >  	if (ret)
> >  		return ret;
> > -	return ustcomm_recv_app_reply(sock, lur, lum->handle, lum->cmd);
> > +	ret = ustcomm_recv_app_reply(sock, lur, lum->handle, lum->cmd);
> > +	if (ret > 0)
> > +		return -EIO;
> > +	return ret;
> >  }
> >  
> >  /*
> > 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-21 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-21 15:21 [lttng-dev] [PATCH] Fix I/O-related error values in ustctl Mathieu Desnoyers
2013-01-21 15:54 ` David Goulet
2013-01-21 15:58   ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox