All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
@ 2015-02-11  7:35 Ma Shimiao
       [not found] ` <1423640156-25233-1-git-send-email-mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Ma Shimiao @ 2015-02-11  7:35 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, Ma Shimiao

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
+.TE
 .SH CONFORMING TO
 SVr4.
 .SH SEE ALSO
-- 
1.9.3

--
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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [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>
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-02-11  7:55 UTC (permalink / raw)
  To: Ma Shimiao
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA

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?

Thanks,

Michael


> +.TE
>  .SH CONFORMING TO
>  SVr4.
>  .SH SEE ALSO
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [not found]     ` <54DB0AE3.1080406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-02-11  8:20       ` Ma Shimiao
       [not found]         ` <54DB10D4.1050508-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Ma Shimiao @ 2015-02-11  8:20 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

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.

Best regards
> 
> Thanks,
> 
> Michael
> 
> 
>> +.TE
>>  .SH CONFORMING TO
>>  SVr4.
>>  .SH SEE ALSO
>>
> 
> 


-- 
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [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>
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-02-11  8:28 UTC (permalink / raw)
  To: Ma Shimiao; +Cc: linux-man

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()"?

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [not found]             ` <CAKgNAki3zOD8-C8PmsDmeqVdY0yOTA=wAR_1giZF3U3-N9i-fQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-02-11  9:38               ` Ma Shimiao
       [not found]                 ` <54DB2306.2010101-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Ma Shimiao @ 2015-02-11  9:38 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [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>
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-02-11 10:20 UTC (permalink / raw)
  To: Ma Shimiao; +Cc: linux-man

Hi Ma Shimiao,

On 11 February 2015 at 10:38, Ma Shimiao <mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:
> 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.

All of the above is fine. But:

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

I think many readers will not be able to deduce this. (And I think
readers of the glibc manual will have exactly the same problem.) I
think we somehow need to make this a bit clearer, perhaps in a
sentence following the table. Would you have a proposal for such a
sentence?

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [not found]                     ` <CAKgNAkiFiGHoTfS3P+Az13EDZzBTXqcBzjmCpt2ybH0KsfkK4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-02-12  1:24                       ` Ma Shimiao
       [not found]                         ` <54DC00CA.5080407-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Ma Shimiao @ 2015-02-12  1:24 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man

Hi Michael,
On 02/11/2015 06:20 PM, Michael Kerrisk (man-pages) wrote:
> Hi Ma Shimiao,
> 
> On 11 February 2015 at 10:38, Ma Shimiao <mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:
>> 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.
> 
> All of the above is fine. But:
> 
>> If a reader understand the definition of race, I think he can know that "grent" refers to
>> getgrent(), setgrent() and endgrent().
> 
> I think many readers will not be able to deduce this. (And I think
> readers of the glibc manual will have exactly the same problem.) I
> think we somehow need to make this a bit clearer, perhaps in a
> sentence following the table. Would you have a proposal for such a
> sentence?

How about the following sentence?
"grent" in "race:grent" is an identifier which groups functions xxxgrent() used to remind that
if functions xxxgrent() were used together in multi-thread, data race would occur.

Or any good ideas?

Thanks,
> 
> Cheers,
> 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [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>
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-02-12  8:22 UTC (permalink / raw)
  To: Ma Shimiao; +Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man

Hello Ma Shimiao,

On 02/12/2015 02:24 AM, Ma Shimiao wrote:
> Hi Michael,
> On 02/11/2015 06:20 PM, Michael Kerrisk (man-pages) wrote:
>> Hi Ma Shimiao,
>>
>> On 11 February 2015 at 10:38, Ma Shimiao <mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:
>>> 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.
>>
>> All of the above is fine. But:
>>
>>> If a reader understand the definition of race, I think he can know that "grent" refers to
>>> getgrent(), setgrent() and endgrent().
>>
>> I think many readers will not be able to deduce this. (And I think
>> readers of the glibc manual will have exactly the same problem.) I
>> think we somehow need to make this a bit clearer, perhaps in a
>> sentence following the table. Would you have a proposal for such a
>> sentence?
> 
> How about the following sentence?
> "grent" in "race:grent" is an identifier which groups functions xxxgrent() used to remind that
> if functions xxxgrent() were used together in multi-thread, data race would occur.

I think that's a good start, but I'd prefer something a little more explicit:

[[
In the above table,
.I grent in
.I race:grent
signifies that if any of the functions
.BR setgrent (),
.BR getgrent (),
or
.BR endgrent ()
are used in parallel in different threads of a program, then data races could occur.
]]

How would that be?

Also, what is the analogous text for fgetgrent() / "fgrent"? Is the problem
races between different threads using fgetgrent() or is it races with another 
thread using setgrent/getgrent/sendgrent? If the former, I don't understand 
why we need the identifier "fgrent" instead of just using "fgetgrent".

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [not found]                             ` <54DC62B8.3040100-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-02-12  9:41                               ` Ma Shimiao
       [not found]                                 ` <54DC7541.7010603-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Ma Shimiao @ 2015-02-12  9:41 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man

On 02/12/2015 04:22 PM, Michael Kerrisk (man-pages) wrote:
> Hello Ma Shimiao,
> 
> On 02/12/2015 02:24 AM, Ma Shimiao wrote:
>> Hi Michael,
>> On 02/11/2015 06:20 PM, Michael Kerrisk (man-pages) wrote:
>>> Hi Ma Shimiao,
>>>
>>> On 11 February 2015 at 10:38, Ma Shimiao <mashimiao.fnst-BthXqXjhjHV4OK5fxMSSsQ@public.gmane.org.com> wrote:
>>>> 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-BthXqXjhjHU@public.gmane.orgsu.com> 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.
>>>
>>> All of the above is fine. But:
>>>
>>>> If a reader understand the definition of race, I think he can know that "grent" refers to
>>>> getgrent(), setgrent() and endgrent().
>>>
>>> I think many readers will not be able to deduce this. (And I think
>>> readers of the glibc manual will have exactly the same problem.) I
>>> think we somehow need to make this a bit clearer, perhaps in a
>>> sentence following the table. Would you have a proposal for such a
>>> sentence?
>>
>> How about the following sentence?
>> "grent" in "race:grent" is an identifier which groups functions xxxgrent() used to remind that
>> if functions xxxgrent() were used together in multi-thread, data race would occur.
> 
> I think that's a good start, but I'd prefer something a little more explicit:
> 
> [[
> In the above table,
> .I grent in
> .I race:grent
> signifies that if any of the functions
> .BR setgrent (),
> .BR getgrent (),
> or
> .BR endgrent ()
> are used in parallel in different threads of a program, then data races could occur.
> ]]
> 
> How would that be?

That looks fine. I will add them in new patch.
> 
> Also, what is the analogous text for fgetgrent() / "fgrent"? Is the problem
> races between different threads using fgetgrent() or is it races with another 
> thread using setgrent/getgrent/sendgrent? If the former, I don't understand 
> why we need the identifier "fgrent" instead of just using "fgetgrent".
The problem is the former.
At first, I chose fgetgrent as identifier.
Then, I found fgrent is used in glib manual.
As fgetgrent looks like getgrent(), I thought make identifier of race to be
similar is not a bad idea.
At the end, I modified fgetgrent to fgrent.

Now, after thinking for while, fgetgrent seems more suitable.
I‘m sorry for sending patches in haste.
I haven't asked glibc community why they choose to use fgrent.
After talking with them, I will send a new patch.
Is it OK?


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] fgetgrent.3: ATTRIBUTES: Note function that is thread-safe
       [not found]                                 ` <54DC7541.7010603-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
@ 2015-02-12  9:54                                   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-02-12  9:54 UTC (permalink / raw)
  To: Ma Shimiao; +Cc: linux-man

Hello Ma Shimiao,

On 12 February 2015 at 10:41, Ma Shimiao <mashimiao.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> wrote:
> On 02/12/2015 04:22 PM, Michael Kerrisk (man-pages) wrote:
>> Hello Ma Shimiao,
>>
>> On 02/12/2015 02:24 AM, Ma Shimiao wrote:
>>> Hi Michael,
>>> On 02/11/2015 06:20 PM, Michael Kerrisk (man-pages) wrote:
>>>> Hi Ma Shimiao,
>>>>
>>>> On 11 February 2015 at 10:38, Ma Shimiao <mashimiao.fnst-BthXqXjhjHX1P9xLtpHBDw@public.gmane.orgu.com> wrote:
>>>>> 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-RdXDGPcPSAQ@public.gmane.orgtsu.com> 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.
>>>>
>>>> All of the above is fine. But:
>>>>
>>>>> If a reader understand the definition of race, I think he can know that "grent" refers to
>>>>> getgrent(), setgrent() and endgrent().
>>>>
>>>> I think many readers will not be able to deduce this. (And I think
>>>> readers of the glibc manual will have exactly the same problem.) I
>>>> think we somehow need to make this a bit clearer, perhaps in a
>>>> sentence following the table. Would you have a proposal for such a
>>>> sentence?
>>>
>>> How about the following sentence?
>>> "grent" in "race:grent" is an identifier which groups functions xxxgrent() used to remind that
>>> if functions xxxgrent() were used together in multi-thread, data race would occur.
>>
>> I think that's a good start, but I'd prefer something a little more explicit:
>>
>> [[
>> In the above table,
>> .I grent in
>> .I race:grent
>> signifies that if any of the functions
>> .BR setgrent (),
>> .BR getgrent (),
>> or
>> .BR endgrent ()
>> are used in parallel in different threads of a program, then data races could occur.
>> ]]
>>
>> How would that be?
>
> That looks fine. I will add them in new patch.

Thank you!

>> Also, what is the analogous text for fgetgrent() / "fgrent"? Is the problem
>> races between different threads using fgetgrent() or is it races with another
>> thread using setgrent/getgrent/sendgrent? If the former, I don't understand
>> why we need the identifier "fgrent" instead of just using "fgetgrent".
> The problem is the former.
> At first, I chose fgetgrent as identifier.
> Then, I found fgrent is used in glib manual.
> As fgetgrent looks like getgrent(), I thought make identifier of race to be
> similar is not a bad idea.
> At the end, I modified fgetgrent to fgrent.
>
> Now, after thinking for while, fgetgrent seems more suitable.
> I‘m sorry for sending patches in haste.
> I haven't asked glibc community why they choose to use fgrent.
> After talking with them, I will send a new patch.

Sounds good to me!

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-02-12  9:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
     [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)

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.