A NOTE has been added to this issue. 
====================================================================== 
https://austingroupbugs.net/view.php?id=1220 
====================================================================== 
Reported By:                bhaible
Assigned To:                
====================================================================== 
Project:                    1003.1(2016/18)/Issue7+TC2
Issue ID:                   1220
Category:                   System Interfaces
Type:                       Omission
Severity:                   Editorial
Priority:                   normal
Status:                     New
Name:                       Bruno Haible 
Organization:               GNU 
User Reference:              
Section:                    --- 
Page Number:                --- 
Line Number:                --- 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2018-12-20 13:46 UTC
Last Modified:              2020-10-07 13:29 UTC
====================================================================== 
Summary:                    Add an API to query the name of a locale category of
a locale object
====================================================================== 

---------------------------------------------------------------------- 
 (0005035) geoffclare (manager) - 2020-10-07 13:29
 https://austingroupbugs.net/view.php?id=1220#c5035 
---------------------------------------------------------------------- 
Alternative changes that solve the thread-safety problem by having
getlocalename_l() handle LC_GLOBAL_LOCALE ...

On page 286 line 9687 section <locale.h>, add:<blockquote><pre>[CX]const
char *getlocalename_l(int, locale_t);[/CX]</pre></blockquote>
On page 1050 insert a new getlocalename_l page:

<b>NAME</b><blockquote>getlocalename_l - get a locale name from a locale
object</blockquote>
<b>SYNOPSIS</b><blockquote><pre>[CX]#include <locale.h>

const char * getlocalename_l(int category, locale_t
locobj);[/CX]</pre></blockquote>
<b>DESCRIPTION</b><blockquote>The <i>getlocalename_l</i>() function shall
return the locale name for the given locale category of the locale object
<i>locobj</i>, or of the global locale if <i>locobj</i> is the special
locale object LC_GLOBAL_LOCALE.

The <i>category</i> argument specifies the locale category to be queried.
If the value is LC_ALL or is not a supported locale category value (see
[xref to setlocale()]), <i>getlocalename_l</i>() shall fail.

The behavior is undefined if the <i>locobj</i> argument is neither the
special locale object LC_GLOBAL_LOCALE nor a valid locale object
handle.</blockquote>
<b>RETURN VALUE</b><blockquote>Upon successful completion,
<i>getlocalename_l</i>() shall return a pointer to a string containing the
locale name; otherwise, a null pointer shall be returned.

If <i>locobj</i> is LC_GLOBAL_LOCALE, the returned string pointer might be
invalidated or the string content might be overwritten by a subsequent call
in the same thread to <i>getlocalename_l</i>() with LC_GLOBAL_LOCALE; the
returned string pointer might also be invalidated if the calling thread is
terminated.  Otherwise, the returned string pointer and content shall
remain valid until the locale object <i>locobj</i> is used in a call to
<i>freelocale</i>() or as the <i>base</i> argument in a successful call to
<i>newlocale</i>().</blockquote>
<b>ERRORS</b><blockquote>No errors are defined.</blockquote>
<b>EXAMPLES</b><blockquote><b>Determining the locale name for a category of
the current locale</b>

The following example shows how to obtain the locale name for the
LC_NUMERIC category of the current thread-local locale, or of the global
locale if no thread-local locale is in use.<pre>#include <locale.h>
...
const char *name;
locale_t loc = uselocale(NULL);
name = getlocalename_l(LC_NUMERIC, loc);
</pre></blockquote>
<b>APPLICATION USAGE</b><blockquote>None.</blockquote>
<b>RATIONALE</b><blockquote>Historical versions of <i>getlocalename_l</i>()
did not handle the special locale object LC_GLOBAL_LOCALE, requiring that
applications used <i>setlocale</i>(<i>category</i>, NULL) to query the
global locale if <i>uselocale</i>(NULL) returned LC_GLOBAL_LOCALE. However,
since <i>setlocale</i>() is not required to be thread-safe (even when the
only concurrent calls are ones that query the locale), this method was
problematic for multi-threaded processes.  This standard requires that
<i>getlocalename_l</i>(<i>category</i>, LC_GLOBAL_LOCALE) queries the
global locale in a thread-safe manner, for example by returning a pointer
to a thread-local internal buffer instead of a process-wide internal
buffer.</blockquote>
<b>FUTURE DIRECTIONS</b><blockquote>None.</blockquote>
<b>SEE ALSO</b><blockquote>freelocale(), newlocale(), setlocale(),
uselocale()

XBD Chapter 7 (on page XXX), <locale.h></blockquote>
<b>CHANGE HISTORY</b><blockquote>First released in Issue 8.</blockquote>
Add getlocalename_l() to the SEE ALSO section for each page listed in the
getlocalename_l() SEE ALSO above.

On page 3791 line 130104 section E.1, add getlocalename_l() to the
POSIX_MULTI_CONCURRENT_LOCALES subprofile group. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2018-12-20 13:46 bhaible        New Issue                                    
2018-12-20 13:46 bhaible        Name                      => Bruno Haible    
2018-12-20 13:46 bhaible        Organization              => GNU             
2018-12-20 13:46 bhaible        Section                   => ---             
2018-12-20 13:46 bhaible        Page Number               => ---             
2018-12-20 13:46 bhaible        Line Number               => ---             
2020-10-05 11:11 geoffclare     Note Added: 0005026                          
2020-10-05 11:13 geoffclare     Note Edited: 0005026                         
2020-10-05 11:13 geoffclare     Note Edited: 0005026                         
2020-10-05 15:45 bhaible        Note Added: 0005027                          
2020-10-05 17:57 shware_systems Note Added: 0005030                          
2020-10-05 17:58 shware_systems Note Edited: 0005030                         
2020-10-07 13:29 geoffclare     Note Added: 0005035                          
======================================================================


  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to