public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: "Tomáš Golembiovský" <tgolembi@redhat.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH] close.2: Suggest shutdown(2) when closing socket from another thread
Date: Thu, 14 Sep 2023 09:39:31 +0200	[thread overview]
Message-ID: <ZQK4s9zARDHAhQxN@cremorrah> (raw)
In-Reply-To: <e0d5e4a4-82d4-68ae-a2c0-9c3e0b779806@kernel.org>

On Fri, Aug 25, 2023 at 08:05:01PM +0200, Alejandro Colomar wrote:
> Hi Tomáš,
> 
> On 2023-08-22 17:19, Tomáš Golembiovský wrote:
> > This is another take on the ancient saga of closing sockets from one
> > thread while another thread is blocked on recv(2). It all started with
> > [1,2] and continued by [3]. It was established that this is expected and
> > long term behavior or Linux and the issue was closed by Michael Kerrisk
> > by commit c2f15a1349a7271f6c1d81361ec8b256266e1c09.
> > 
> > This is all fine and the patch covered the issue in general terms.
> > However, it does not mention the specific case of sockets and shutdown,
> > where the issue can be (at least for the read case) mitigated by proper
> > shutdown. While one may argue that such information may be implied by
> > other man pages (perhaps return value of recv(2)) and thus is redundant,
> > it seems only fair to mention shutdown(2) here as it is only rarely
> > noted in Linux documentation that properly shutting down both side of
> > the socket is a good programming practice when dealing with sockets.
> > 
> > As a test program I am attaching the program originally written by Lukas
> > Czerner. Only with small fixes here and there.
> > 
> > [1] https://lore.kernel.org/linux-man/1314620800-15587-1-git-send-email-lczerner@redhat.com/
> > [2] https://bugzilla.redhat.com/show_bug.cgi?id=650985
> > [3] https://bugzilla.kernel.org/show_bug.cgi?id=53781
> > 
> > ```c
> > /**
> >  * Copyright 2011 (C) Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
> >  * Copyright 2023 (C) Red Hat, Inc., Tomas Golembiovsky <tgolembi@redhat.com>
> >  *
> >  * This program is free software; you can redistribute it and/or
> >  * modify it under the terms of the GNU General Public License as
> >  * published by the Free Software Foundation.
> 
> No version of the GPL may be understood as GPL-1.0-or-later.  I suggest
> specifying.  But rather, we prefer SPDX license tags in this project,
> so could you please specify the license as something SPDX?

I have checked with Lukas and GPL-2.0-or-later will be used. I will post
a new patch with updated file header.

    Tomas


      reply	other threads:[~2023-09-14  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 15:19 [PATCH] close.2: Suggest shutdown(2) when closing socket from another thread Tomáš Golembiovský
2023-08-25 18:05 ` Alejandro Colomar
2023-09-14  7:39   ` Tomáš Golembiovský [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQK4s9zARDHAhQxN@cremorrah \
    --to=tgolembi@redhat.com \
    --cc=alx@kernel.org \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox