View | Details | Return to bug 67578
Collapse All | Expand All

(-)a/libstdc++-v3/config.h.in (+3 lines)
Lines 267-272 Link Here
267
/* Define if futex syscall is available. */
267
/* Define if futex syscall is available. */
268
#undef HAVE_LINUX_FUTEX
268
#undef HAVE_LINUX_FUTEX
269
269
270
/* Define to 1 if you have the <linux/random.h> header file. */
271
#undef HAVE_LINUX_RANDOM_H
272
270
/* Define to 1 if you have the <locale.h> header file. */
273
/* Define to 1 if you have the <locale.h> header file. */
271
#undef HAVE_LOCALE_H
274
#undef HAVE_LOCALE_H
272
275
(-)a/libstdc++-v3/config/abi/post/i386-linux-gnu/baseline_symbols.txt (+1 lines)
Lines 444-449 FUNC:_ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv@GLIBCXX_3.4 Link Here
444
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4
444
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4
445
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
445
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
446
FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
446
FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
447
FUNC:_ZNKSt13random_device13_M_getentropyEv@@GLIBCXX_3.4.23
447
FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4
448
FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4
448
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4
449
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4
449
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5
450
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5
(-)a/libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt (+1 lines)
Lines 444-449 FUNC:_ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv@GLIBCXX_3.4 Link Here
444
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4
444
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4
445
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
445
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
446
FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
446
FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
447
FUNC:_ZNKSt13random_device13_M_getentropyEv@@GLIBCXX_3.4.23
447
FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4
448
FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4
448
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4
449
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4
449
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5
450
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5
(-)a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt (+1 lines)
Lines 444-449 FUNC:_ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv@GLIBCXX_3.4 Link Here
444
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4
444
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4
445
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
445
FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
446
FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
446
FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4
447
FUNC:_ZNKSt13random_device13_M_getentropyEv@@GLIBCXX_3.4.23
447
FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4
448
FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4
448
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4
449
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4
449
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5
450
FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5
(-)a/libstdc++-v3/config/abi/pre/gnu.ver (+3 lines)
Lines 1965-1970 GLIBCXX_3.4.23 { Link Here
1965
    _ZNSt13__future_base13_State_baseV211_Make_ready6_M_setEv;
1965
    _ZNSt13__future_base13_State_baseV211_Make_ready6_M_setEv;
1966
#endif
1966
#endif
1967
1967
1968
    # std::random_device::_M_getentropy() const
1969
    _ZNKSt13random_device13_M_getentropyEv;
1970
1968
} GLIBCXX_3.4.22;
1971
} GLIBCXX_3.4.22;
1969
1972
1970
# Symbols in the support library (libsupc++) have their own tag.
1973
# Symbols in the support library (libsupc++) have their own tag.
(-)a/libstdc++-v3/configure (-2 / +2 lines)
Lines 18391-18397 else Link Here
18391
          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18391
          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18392
/* end confdefs.h.  */
18392
/* end confdefs.h.  */
18393
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
18393
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
18394
#include <math.h>
18394
             #include <math.h>
18395
             #undef isnan
18395
             #undef isnan
18396
             namespace std {
18396
             namespace std {
18397
               using ::isnan;
18397
               using ::isnan;
Lines 21795-21801 for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \ Link Here
21795
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
21795
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
21796
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
21796
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
21797
sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
21797
sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
21798
wchar.h wctype.h
21798
wchar.h wctype.h linux/random.h
21799
do :
21799
do :
21800
  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
21800
  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
21801
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
21801
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
(-)a/libstdc++-v3/configure.ac (-1 / +1 lines)
Lines 237-243 AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \ Link Here
237
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
237
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
238
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
238
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
239
sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
239
sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
240
wchar.h wctype.h])
240
wchar.h wctype.h linux/random.h])
241
241
242
# Only do link tests if native. Else, hardcode.
242
# Only do link tests if native. Else, hardcode.
243
if $GLIBCXX_IS_NATIVE; then
243
if $GLIBCXX_IS_NATIVE; then
(-)a/libstdc++-v3/include/bits/random.h (-1 / +8 lines)
Lines 1603-1609 _GLIBCXX_BEGIN_NAMESPACE_VERSION Link Here
1603
1603
1604
    double
1604
    double
1605
    entropy() const noexcept
1605
    entropy() const noexcept
1606
    { return 0.0; }
1606
    {
1607
#ifdef _GLIBCXX_USE_RANDOM_TR1
1608
      return this->_M_getentropy();
1609
#else
1610
      return 0.0;
1611
#endif
1612
    }
1607
1613
1608
    result_type
1614
    result_type
1609
    operator()()
1615
    operator()()
Lines 1627-1632 _GLIBCXX_BEGIN_NAMESPACE_VERSION Link Here
1627
1633
1628
    result_type _M_getval();
1634
    result_type _M_getval();
1629
    result_type _M_getval_pretr1();
1635
    result_type _M_getval_pretr1();
1636
    double _M_getentropy() const noexcept;
1630
1637
1631
    union
1638
    union
1632
    {
1639
    {
(-)a/libstdc++-v3/src/c++11/random.cc (-1 / +36 lines)
Lines 38-43 Link Here
38
# include <unistd.h>
38
# include <unistd.h>
39
#endif
39
#endif
40
40
41
#ifdef _GLIBCXX_HAVE_SYS_IOCTL_H
42
# include <sys/ioctl.h>
43
#endif
44
45
#ifdef _GLIBCXX_HAVE_LINUX_RANDOM_H
46
# include <linux/random.h>
47
#endif
48
41
namespace std _GLIBCXX_VISIBILITY(default)
49
namespace std _GLIBCXX_VISIBILITY(default)
42
{
50
{
43
  namespace
51
  namespace
Lines 161-166 namespace std _GLIBCXX_VISIBILITY(default) Link Here
161
    return _M_mt();
169
    return _M_mt();
162
  }
170
  }
163
171
172
  double
173
  random_device::_M_getentropy() const noexcept
174
  {
175
#if defined _GLIBCXX_HAVE_SYS_IOCTL_H && \
176
    defined _GLIBCXX_HAVE_LINUX_RANDOM_H
177
    if (!_M_file)
178
      return 0.0;
179
180
    int fd = fileno(static_cast<FILE *>(_M_file));
181
    if (fd < 0)
182
      return 0.0;
183
184
    int ent;
185
    if (ioctl(fd, RNDGETENTCNT, &ent) < 0)
186
      return 0.0;
187
188
    if (ent < 0)
189
      return 0.0;
190
191
    if (static_cast<unsigned>(ent) > sizeof(result_type) * 8)
192
      return static_cast<double>(sizeof(result_type) * 8);
193
194
    return static_cast<double>(ent);
195
#else
196
    return 0.0;
197
#endif
198
  }
199
164
  template class mersenne_twister_engine<
200
  template class mersenne_twister_engine<
165
    uint_fast32_t,
201
    uint_fast32_t,
166
    32, 624, 397, 31,
202
    32, 624, 397, 31,
167
- 

Return to bug 67578