linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Carlos O'Donell" <carlos-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Alexandre Oliva <aoliva-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Michael Kerrisk
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Rich Felker <dalias-8zAoT0mYgF4@public.gmane.org>,
	Peng Haitao <penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>,
	"linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	GNU C Library
	<libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org>
Subject: Re: Adding reentrancy information to safety notes?
Date: Wed, 31 Dec 2014 11:07:18 -0500	[thread overview]
Message-ID: <54A41F36.5010800@redhat.com> (raw)
In-Reply-To: <orppb0dur7.fsf-o1YuAO9g/txBDLzU/O5InQ@public.gmane.org>

On 12/31/2014 04:38 AM, Alexandre Oliva wrote:
> On Dec 31, 2014, "Carlos O'Donell" <carlos-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> 
>> That is not the definition of reentrancy that I had in mind.
> 
> Since reentrant is such an overloaded term, how about using the term
> Recursion-Safe, that AFAICT covers only the concept you have in mind.
> Another possible term that occurs to me is Synchronously Reentrant, to
> indicate it doesn't cover asynchronous reentrancy out of signals or
> multiple threads.  We could then shorten it as SR-Safe.

Michael,

Any suggestion for an alternate term?

Alex,
 
In hindsight I see that reetrancy is an overloaded term.
The POSIX standard uses "reentrant by signals" to mean AS-Safe.
Several authors seem to use "reetrant by another thread" 
to mean MT-safe. Thus without some kind of qualifier the term
reentrant seems ambiguous at best.

You suggest "synchronously reentrant", and that might be the
best and most flexible definition. You have to define at what
points the function might be synchronously reentered, much like
synchronous cancellation defines such points. In the case of
glibc internals you can be synchronously reentered only if you
call a function that might directly or indirectly call malloc,
calloc, realloc, or free. AFAIK these are the only functions
that allow users to synchronously interrupt glibc internal
operations and call back into the runtime. Application calls
to core runtime functions may be interposed and in those cases
the interposing function must follow the standard requirements,
but for maximum compatibility may need to adhere to the
preliminary safety notes along with the new SR notes.

Note that synchronously reetrant would still follow the
definition I gave in the previous email. Restated here with
some slight rewording:
~~~~
A function is synchronously reentrant if a thread may safely
call the function before a previous call to the same function
by the same thread completes, but need not be safe if the
second or subsequent calls are made while handling an
asynchronous signal or by another thread.
~~~~

I amended the definition to say "asynchronous signal" since
it is possible for user code to synchronously handle signals
and that such synchronous signal handlers could make effective
use of SR-safe functions since such handlers would be known
not to be asynchronously interrupting any such previous calls
to the SR-safe functions. Similarly synchronous cancellation
handlers should be able to call SR-safe functions?

Cheers,
Carlos.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-12-31 16:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30 15:45 Adding reentrancy information to safety notes? Carlos O'Donell
     [not found] ` <54A2C8A6.9050100-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-30 19:53   ` Michael Kerrisk (man-pages)
2014-12-30 20:08     ` Carlos O'Donell
     [not found]       ` <54A30624.7070207-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-30 20:35         ` Michael Kerrisk (man-pages)
2014-12-30 22:55   ` Alexandre Oliva
     [not found]     ` <ork318eoj4.fsf-o1YuAO9g/txBDLzU/O5InQ@public.gmane.org>
2014-12-30 23:05       ` Rich Felker
     [not found]         ` <20141230230529.GT4574-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2014-12-31  1:43           ` Alexandre Oliva
2014-12-31  4:12             ` Carlos O'Donell
     [not found]               ` <54A377B8.60802-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-31  9:31                 ` Alexandre Oliva
     [not found]                   ` <ortx0cdv3c.fsf-o1YuAO9g/txBDLzU/O5InQ@public.gmane.org>
2014-12-31 15:26                     ` Carlos O'Donell
     [not found]                       ` <54A41595.4010007-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-01  7:05                         ` Alexandre Oliva
2015-01-05 14:25                           ` Carlos O'Donell
2015-01-01  0:19                 ` Rich Felker
     [not found]                   ` <20150101001905.GU4574-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2015-01-05 15:05                     ` Carlos O'Donell
2014-12-31  9:38               ` Alexandre Oliva
     [not found]                 ` <orppb0dur7.fsf-o1YuAO9g/txBDLzU/O5InQ@public.gmane.org>
2014-12-31 16:07                   ` Carlos O'Donell [this message]
     [not found]                     ` <54A41F36.5010800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-01  7:11                       ` Alexandre Oliva
2015-01-05 15:26                         ` Carlos O'Donell
2015-01-05 23:21                           ` Alexandre Oliva
2015-01-07  9:52                       ` Michael Kerrisk (man-pages)

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=54A41F36.5010800@redhat.com \
    --to=carlos-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=aoliva-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dalias-8zAoT0mYgF4@public.gmane.org \
    --cc=libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).