[Spice-devel] [PATCH 4/7] server/inputs_channel: don't set O_ASYNC option on socket

Alon Levy alevy at redhat.com
Sun Jan 22 05:35:34 PST 2012


On Thu, Jan 19, 2012 at 02:10:01PM -0600, Dan McGee wrote:
> output to send a SIGIO signal to the running program. However, we don't
> handle this signal anywhere in the code, so setting the option is
> unnecessary.
> 

ACK.

I can't find anything explaining why this why done - seems you are right
about your interpretation. But note that I checked it via the same
methods - reading the man page and other sources; googling found very
little, also read chapter 63 of "The Linux Programming Interface",
so this is the blind acking the deaf :)

> Signed-off-by: Dan McGee <dpmcgee at gmail.com>
> ---
> 
> If anyone knows more about O_ASYNC than I do, please speak up, but doing some
> reading and research leads me to believe I'm not lying in my commit message
> above.
> 
> From the manpage:
> 
> If you set the O_ASYNC status flag on a file descriptor by using the F_SETFL command of fcntl(), a SIGIO signal is sent whenever input or output becomes possible on that file descriptor. F_SETSIG can be used to obtain delivery of a signal other than SIGIO. If this permission check fails, then the signal is silently discarded.
> 
>  server/inputs_channel.c |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/server/inputs_channel.c b/server/inputs_channel.c
> index 83c2cad..a3f26c0 100644
> --- a/server/inputs_channel.c
> +++ b/server/inputs_channel.c
> @@ -282,7 +282,8 @@ static void inputs_channel_send_item(RedChannelClient *rcc, PipeItem *base)
>      red_channel_client_begin_send_message(rcc);
>  }
>  
> -static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint16_t type, void *message)
> +static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint16_t type,
> +                                        void *message)
>  {
>      InputsChannel *inputs_channel = (InputsChannel *)rcc->channel;
>      InputsChannelClient *icc = (InputsChannelClient *)rcc;
> @@ -464,7 +465,6 @@ static void inputs_pipe_add_init(RedChannelClient *rcc)
>  
>  static int inputs_channel_config_socket(RedChannelClient *rcc)
>  {
> -    int flags;
>      int delay_val = 1;
>      RedsStream *stream = red_channel_client_get_stream(rcc);
>  
> @@ -476,11 +476,6 @@ static int inputs_channel_config_socket(RedChannelClient *rcc)
>          }
>      }
>  
> -    if ((flags = fcntl(stream->socket, F_GETFL)) == -1 ||
> -                 fcntl(stream->socket, F_SETFL, flags | O_ASYNC) == -1) {
> -        red_printf("fcntl failed, %s", strerror(errno));
> -        return FALSE;
> -    }
>      return TRUE;
>  }
>  
> -- 
> 1.7.8.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list