Hello.
I looked at coreutils testsuite. One of the tests failed, because it uses the following function to query thread locale:

const char *
gl_locale_name_thread_unsafe (int category, const char *categoryname)
{
# if HAVE_USELOCALE
  {
    locale_t thread_locale = uselocale (NULL);
    if (thread_locale != LC_GLOBAL_LOCALE)
      {
#  if __GLIBC__ >= 2 && !defined __UCLIBC__
/* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
           glibc < 2.12.
See <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
        const char *name =
          nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
        if (name[0] == '\0')
          /* Fallback code for glibc < 2.4, which did not implement
             nl_langinfo (_NL_LOCALE_NAME (category)).  */
          name = thread_locale->__names[category];
        return name;
#  elif defined __FreeBSD__ || (defined __APPLE__ && defined __MACH__)
        /* FreeBSD, Mac OS X */
        int mask;

        switch (category)
          {
          case LC_CTYPE:
            mask = LC_CTYPE_MASK;
            break;
          case LC_NUMERIC:
            mask = LC_NUMERIC_MASK;
            break;
          case LC_TIME:
            mask = LC_TIME_MASK;
            break;
          case LC_COLLATE:
            mask = LC_COLLATE_MASK;
            break;
          case LC_MONETARY:
            mask = LC_MONETARY_MASK;
            break;
          case LC_MESSAGES:
            mask = LC_MESSAGES_MASK;
            break;
          default: /* We shouldn't get here.  */
            return "";
          }
        return querylocale (mask, thread_locale);
#  endif
      }
  }
# endif
  return NULL;
}

As you see, on illumos it just returns NULL.

Solaris 12 has getlocalename_l (category, thread_locale) function.

Do we have some similar function?

The following patch was proposed for Solaris:



diff --git a/lib/localename.c b/lib/localename.c
index 815171c..c6f326e 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -42,6 +42,10 @@
 # if !defined IN_LIBINTL
 #  include "glthread/lock.h"
 # endif
+# if defined __sun
+/* Solaris >= 12.  */
+extern char * getlocalename_l(int, locale_t);
+# endif
 #endif

 #if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE
@@ -2584,7 +2588,7 @@ get_lcid (const char *locale_name)
 #endif


-#if HAVE_USELOCALE /* glibc or Mac OS X */
+#if HAVE_USELOCALE /* glibc, Solaris >= 12 or Mac OS X */

/* Simple hash set of strings. We don't want to drag in lots of hash table
    code here.  */
@@ -2723,6 +2727,9 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname)
             return "";
           }
         return querylocale (mask, thread_locale);
+#  elif defined __sun
+        /* Solaris >= 12.  */
+        return getlocalename_l (category, thread_locale);
 #  endif
       }
   }
--
2.1.0


--
System Administrator of Southern Federal University Computer Center


-------------------------------------------
illumos-discuss
Archives: https://www.listbox.com/member/archive/182180/=now
RSS Feed: https://www.listbox.com/member/archive/rss/182180/21175430-2e6923be
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=21175430&id_secret=21175430-6a77cda4
Powered by Listbox: http://www.listbox.com

Reply via email to