[PATCH] manual: Document setlogmask as MT-safe.

Carlos O'Donell carlos@redhat.com
Mon Feb 17 14:29:50 GMT 2025


On 2/13/25 4:04 PM, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
> 
>> On 13/02/25 16:29, Carlos O'Donell wrote:
>>> setlogmask(3) was made MT-safe in glibc-2.33 with the fix for
>>> bug 26100.
>>> ---
>>>  manual/syslog.texi | 5 +----
>>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>>
>>> diff --git a/manual/syslog.texi b/manual/syslog.texi
>>> index 02f84d6e6f..90a6487c02 100644
>>> --- a/manual/syslog.texi
>>> +++ b/manual/syslog.texi
>>> @@ -498,10 +498,7 @@ The symbols referred to in this section are declared in the file
>>>  
>>>  @deftypefun int setlogmask (int @var{mask})
>>>  @standards{BSD, syslog.h}
>>> -@safety{@prelim{}@mtunsafe{@mtasurace{:LogMask}}@asunsafe{}@acsafe{}}
>>> -@c Read and modify are not guarded by syslog_lock, so concurrent changes
>>> -@c or even uses are undefined.  This should use an atomic swap instead,
>>> -@c at least for modifications.
>>> +@safety{@prelim{}@mtsafe{}@asunsafe{}@acsafe{}}
>>>  
>>
>> Maybe update this comment with your remarks [1]?
>>
>> https://sourceware.org/bugzilla/show_bug.cgi?id=26100#c3
> 
> The __progname aspect mentioned there does not apply to setlogmask.

Correct.

We currently only use "@mtsenv{} @mtslocale{}" for syslog, but we should
expand this to note the program name needs to be constant too e.g.
@mtsprogname{}? Where we define @mtsprogname{} to mean that all program
name variants are assumed to be constant.

Note: Initially __progname points to "" (in rodata), then is adjusted by
__init_misc to point to argv[0] if valid. Likewise __progname_full.
Likewise program_invocation_name, and program_invocation_short_name
(which are GNU extensions). I consider all of these to be program name
variants.

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list