[Spice-devel] [PATCH 4/7] server/inputs_channel: don't set O_ASYNC option on socket
Hans de Goede
hdegoede at redhat.com
Fri Jan 20 00:55:06 PST 2012
This looks like a good catch to me, but I would
like to see a review by someone who knows this code a bit
better then me. Alon ? Yonit?
Regards,
Hans
On 01/19/2012 09:10 PM, 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.
>
> 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;
> }
>
More information about the Spice-devel
mailing list