Hi,

my impression is there are two totally independent topics in this
thread.

 1. Whether and how to make things safer, ideally terminating the
    program in a controlled manner, if it uses functions that are
    not thread-safe in an invalid manner.  I'm not addressing that
    topic in this mail.

 2. Whether we want additional non-standard xlocale.h functions
    in our libc.

Regarding topic 2, let me say up front that i do not feel strongly
either way.  It seems to me this is mostly a question for porters.
If some functions are widely used - even if non-standard - and help
avoid porting hassle, then sure, let's have them unless they cause
excessive fuss.  But the latter does not seem likely here.

There are a number of functions that seem likely useful to me off
the top of my head, for example: querylocale, nl_langinfo_l,
MB_CUR_MAX_L, wcwidth_l

In general, i must say i like the whole xlocale.h business not all
that much: in a nutshell, it is doubling the number of half the
functions under the sun, which usually indicates poor design in the
first place, and then the vast majority of these additional functions
are almost useless on any operating system and totally useless on
OpenBSD.  Like, i mean, btowc_l(3)?  Or even the isdigit_l(3) which
we already have?  You must be choking, Mr. Chisnall!  I don't think
stuff should be added because it is out there, but only if there is
at least some porting benefit.

Regarding the FreeBSD headers, i like them even less.  There are both
terrible design choices and terrible implementation choices.  Regarding
design, it appears that you *must* #include <xlocale.h> after other
headers - if you include it before, it won't work.  Regarding
implementation, there is quite repulsive macro abuse in xlocale/_ctype.h;
but probably that can be unrolled in LibreSSL style.  Either way, none
of that hinders providing them if doing so yields benefit.

See below for a list of functions that i drafted extremely quickly,
so beware of errors and omissions.  The point isn't to present a
definite plan.  The point is merely to demonstrate the sheer fatness
of the animal and to give a first impression of the degree to which
it stinks and grunts from most of its ends.

If any of this is needed, do porters already know which functions
are in particularly high demand?  Do you have any idea how to find
out which ones are actually useful for porting purposes?

Yours,
  Ingo


Functions we already have marked are with a '*'.

<xlocale/_locale.h>
  useful: querylocale

<xlocale/_langinfo.h>
  useful: nl_langinfo_l*

<xlocale/_stdlib.h>
  useful: MB_CUR_MAX_L
  marginally useful: mbtowc_l mbstowcs_l wctomb_l wcstombs_l
  useless: atof_l atoi_l atol_l atoll_l
           strtod_l strtof_l strtol_l strtold_l strtoll_l strtoul_l strtoull_l
           mblen_l

<xlocale/_wchar.h>
  useful: wcwidth_l wcswidth_l
  marginally useful: fgetwc_l fgetws_l fputwc_l fputws_l getwc_l getwchar_l
                     putwc_l putwchar_l ungetwc_l
                     fwprintf_l fwscanf_l swprintf_l swscanf_l
                     vfwprintf_l vswprintf_l vwprintf_l wprintf_l wscanf_l
                     vfwscanf_l vswscanf_l vwscanf_l
                     mbrlen_l mbrtowc_l mbsinit_l mbsrtowcs_l wcrtomb_l
                     wcsrtombs_l wctob_l mbsnrtowcs_l wcsnrtombs_l
  useless: btowc_l wcsftime_l wcstod_l wcstol_l wcstoul_l
                   wcstof_l wcstold_l wcstoll_l wcstoull_l

<xlocale/_string.h>
  useless: strcasestr_l strcoll_l* strxfrm_l*

<xlocale/_strings.h>
  useless: strcasecmp_l* strncasecmp_l*

<xlocale/_inttypes.h>
  useless: strtoimax_l strtoumax_l wcstoimax_l wcstoumax_l

<xlocale/_monetary.h>
  useless: strfmon_l

<xlocale/_time.h>
  useless: strftime_l* strptime_l

<xlocale/_ctype.h>
  marginally useful: towlower_l* towupper_l* iswctype_l* towctrans_l*
  not sure: nextwctype_l wctype_l wctrans_l* digittoint_l
  useless: isalnum_l* etc.  tolower_l* toupper_l*

include <xlocale/_stdio.h>
  useless: asprintf_l dprintf_l fprintf_l fscanf_l printf_l
           scanf_l snprintf_l sprintf_l sscanf_l
           vfprintf_l vprintf_l vsprintf_l vfscanf_l vscanf_l
           vsnprintf_l vsscanf_l vdprintf_l vasprintf_l

<xlocale/uchar.h>
  not sure: c16rtomb_l c32rtomb_l mbrtoc16_l mbrtoc32_l

Reply via email to