All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ma Shimiao <mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man <linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
Date: Wed, 11 Feb 2015 17:38:14 +0800	[thread overview]
Message-ID: <54DB2306.2010101@cn.fujitsu.com> (raw)
In-Reply-To: <CAKgNAki3zOD8-C8PmsDmeqVdY0yOTA=wAR_1giZF3U3-N9i-fQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 02/11/2015 04:28 PM, Michael Kerrisk (man-pages) wrote:
> Hi Ma Shmiao,
> 
> On 11 February 2015 at 09:20, Ma Shimiao <mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:
>> Hi Michael,
>> On 02/11/2015 03:55 PM, Michael Kerrisk (man-pages) wrote:
>>> On 02/11/2015 08:35 AM, Ma Shimiao wrote:
>>>> The marking matches glibc marking.
>>>>
>>>> Signed-off-by: Ma Shimiao <mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
>>>> ---
>>>>  man3/fgetgrent.3 | 12 ++++++++++++
>>>>  1 file changed, 12 insertions(+)
>>>>
>>>> diff --git a/man3/fgetgrent.3 b/man3/fgetgrent.3
>>>> index 57665dd..e599483 100644
>>>> --- a/man3/fgetgrent.3
>>>> +++ b/man3/fgetgrent.3
>>>> @@ -90,6 +90,18 @@ is set to indicate the cause.
>>>>  Insufficient memory to allocate
>>>>  .I group
>>>>  structure.
>>>> +.SH ATTRIBUTES
>>>> +For an explanation of the terms used in this section, see
>>>> +.BR attributes (7).
>>>> +.TS
>>>> +allbox;
>>>> +lb lb lb
>>>> +l l l.
>>>> +Interface   Attribute       Value
>>>> +T{
>>>> +.BR fgetgrent ()
>>>> +T}  Thread safety   MT-Unsafe race:fgrent
>>>
>>> Why the change here in the V2? What does "fgrent" refer to?
>>
>> race:fgrent is right mark, I made a mistake.
>> race:fgrent is similar to race:grent.
>> race:grent is used to indicate data race exists in getgrent(), setgrent() and endgrent().
>> race:fgrent is used to indicate data race exists when using fgetgrent() in multi-thread.
> 
> My question then is: how does the reader know that "grent" refers to
> "getgrent(), setgrent() and endgrent()"?

>From definition of race in glibc manual, we get:
If data race exists and objects cause data race are not from user,
then the function should be annotated as MT-Unsafe and marked with race.
And we need a colon and an identifier follows race to tell user what causes data race.

getgrent(), setgrent() and endgrent() are usually used together.
Because they need to share an iterator, then data race occurs between them.
We want users to know when using them together in multi-thread, data race makes them
unsafe in multi-thread. But, we can't definitely write which internal object causes data race.
So, we extract the common string 'grent' from functions' name as a identifier which groups 
getgrent(), setgrent() and endgrent() to tell users that the group of *grent() functions 
can't be used together in multi-thread.

If a reader understand the definition of race, I think he can know that "grent" refers to
getgrent(), setgrent() and endgrent(). 

Thanks,
> 
> Thanks,
> 
> Michael
> 


-- 
Ma Shimiao
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
--
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:[~2015-02-11  9:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11  7:35 [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe Ma Shimiao
     [not found] ` <1423640156-25233-1-git-send-email-mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2015-02-11  7:55   ` Michael Kerrisk (man-pages)
     [not found]     ` <54DB0AE3.1080406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-11  8:20       ` Ma Shimiao
     [not found]         ` <54DB10D4.1050508-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2015-02-11  8:28           ` Michael Kerrisk (man-pages)
     [not found]             ` <CAKgNAki3zOD8-C8PmsDmeqVdY0yOTA=wAR_1giZF3U3-N9i-fQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-11  9:38               ` Ma Shimiao [this message]
     [not found]                 ` <54DB2306.2010101-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2015-02-11 10:20                   ` Michael Kerrisk (man-pages)
     [not found]                     ` <CAKgNAkiFiGHoTfS3P+Az13EDZzBTXqcBzjmCpt2ybH0KsfkK4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-12  1:24                       ` Ma Shimiao
     [not found]                         ` <54DC00CA.5080407-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2015-02-12  8:22                           ` Michael Kerrisk (man-pages)
     [not found]                             ` <54DC62B8.3040100-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-12  9:41                               ` Ma Shimiao
     [not found]                                 ` <54DC7541.7010603-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2015-02-12  9:54                                   ` 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=54DB2306.2010101@cn.fujitsu.com \
    --to=mashimiao.fnst-bthxqxjhjhxqfuhtdcdx3a@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.