Print this page
Thread safety fixes.

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/localeimpl.h
          +++ new/usr/src/lib/libc/port/locale/localeimpl.h
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2013 Garrett D'Amore <garrett@damore.org>
       13 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  14   14   */
  15   15  
  16   16  /*
  17   17   * This file implements the 2008 newlocale and friends handling. It is
  18   18   * private to libc.
  19   19   */
  20   20  #ifndef _LOCALEIMPL_H_
  21   21  #define _LOCALEIMPL_H_
  22   22  
  23   23  #ifndef _LCONV_C99
↓ open down ↓ 19 lines elided ↑ open up ↑
  43   43   * even so, the atomic and reference counting will probably *greatly* improve
  44   44   * your life as bootstrapping locale data from files is quite expensive.
  45   45   */
  46   46  
  47   47  #define NLOCDATA        4
  48   48  struct locdata {
  49   49          char            l_lname[ENCODING_LEN+1];        /* locale name */
  50   50          void            *l_data[NLOCDATA];              /* storage area */
  51   51          void            *l_map;                         /* mapped file */
  52   52          size_t          l_map_len;
  53      -        uint32_t        l_refcnt;
       53 +        struct locdata  *l_next;                        /* link cached list */
  54   54  };
  55   55  
  56   56  
  57   57  struct locale {
  58   58          struct locdata  *locdata[LC_ALL];
       59 +        struct locale   *next;
  59   60  
  60   61          /*
  61   62           * Convenience pointers.
  62   63           */
  63   64          const struct lc_ctype           *ctype;
  64   65          const struct lc_collate         *collate;
  65   66          const struct lc_messages        *messages;
  66   67          const struct lc_monetary        *monetary;
  67   68          const struct lc_numeric         *numeric;
  68   69          const struct lc_time            *time;
↓ open down ↓ 5 lines elided ↑ open up ↑
  74   75           * also need to update the lconv structure.  The loaded bit indicates
  75   76           * that the lconv structure is "current" for that category.  It's
  76   77           * sort of an "inverse dirty" bit.
  77   78           */
  78   79          int             loaded[LC_ALL];
  79   80          struct lconv    lconv;
  80   81  };
  81   82  
  82   83  
  83   84  struct locdata *__locdata_alloc(const char *, size_t);
  84      -struct locdata *__locdata_hold(struct locdata *);
  85      -void __locdata_release(struct locdata *);
       85 +void __locdata_free(struct locdata *);
  86   86  struct locdata *__locdata_get_cache(int, const char *);
  87   87  void __locdata_set_cache(int, struct locdata *);
  88   88  
  89   89  struct locdata *__lc_numeric_load(const char *name);
  90   90  struct locdata *__lc_monetary_load(const char *name);
  91   91  struct locdata *__lc_messages_load(const char *name);
  92   92  struct locdata *__lc_time_load(const char *name);
  93   93  struct locdata *__lc_ctype_load(const char *name);
  94   94  struct locdata *__lc_collate_load(const char *name);
  95   95  
  96   96  extern struct locdata   __posix_numeric_locdata;
  97   97  extern struct locdata   __posix_monetary_locdata;
  98   98  extern struct locdata   __posix_messages_locdata;
  99   99  extern struct locdata   __posix_time_locdata;
 100  100  extern struct locdata   __posix_ctype_locdata;
 101  101  extern struct locdata   __posix_collate_locdata;
 102  102  extern locale_t ___global_locale;
 103  103  
 104  104  #endif  /* _LOCALEIMPL_H_ */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX