Граф коммитов

222 Коммитов

Автор SHA1 Сообщение Дата
Adam Hess 6816e8efcf Free everything at shutdown
when the RUBY_FREE_ON_SHUTDOWN environment variable is set, manually free memory at shutdown.

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-12-07 15:52:35 -05:00
Nobuyoshi Nakada 5eef125afe
Dump backtraces to an arbitrary stream when using libprocstat 2023-09-26 09:02:37 +09:00
Nobuyoshi Nakada 78c5bb1136
Remove duplicate `#include <string.h>` [ci skip] 2023-08-27 23:21:20 +09:00
Nobuyoshi Nakada bc8cc68aef Make dtoa.c buildable alone 2023-07-14 18:35:23 +09:00
Nobuyoshi Nakada f42230ff22
Adjust styles [ci skip] 2022-07-27 18:42:27 +09:00
Nobuyoshi Nakada d0a822eec5 Fix dtoa buffer overrun
https://hackerone.com/reports/1248108
2022-04-12 21:30:49 +09:00
Yuta Saito 7ee786388a [wasm] wasm/missing.{c,h}: add missing libc stubs for wasi-libc 2022-01-19 11:19:06 +09:00
Nobuyoshi Nakada 33844f3096
Prefer ANSI-style prototypes over old K&R-style definitions 2021-10-27 10:16:52 +09:00
Nobuyoshi Nakada 80c1faf076
Use C99-defined signbit macro 2021-08-27 12:42:23 +09:00
Nobuyoshi Nakada 04be8e84db
Use C99-defined macros to classify a floating-point number 2021-08-27 12:41:30 +09:00
Nobuyoshi Nakada 2d67027448 Removed missing/dup2.c
This function should be always available, as POSIX-compliant or
Windows platform are required since 1.9.  Also the code in this
file is MT-unsafe.
2021-05-10 15:59:23 +09:00
Nobuyoshi Nakada 3acc81d9e4 Fixed race in dtoa [Bug #17612]
Fixed the race condition when replacing `freelist` entry with its
chained next element.  At acquiring an entry, hold the entry once
with the special value, then release by replacing it with the next
element again after acquired.  If another thread is holding the
same entry at that time, spinning until the entry gets released.

Co-Authored-By: Koichi Sasada <ko1@atdot.net>
2021-02-10 19:44:47 +09:00
Nobuyoshi Nakada 2adbf01ae1
dtoa.c: make thread-safe by using atomic CAS 2021-01-10 18:19:53 +09:00
Nobuyoshi Nakada 34d02631e7
dtoa.c: constified
clang seems to locate never modified local data in the const
segment implicitly.
2021-01-10 16:42:36 +09:00
Nobuyoshi Nakada 63abb5c227
dtoa.c: make compilable independently
Except for `-Dxmalloc=malloc -Dxfree=free`.
2021-01-10 16:28:58 +09:00
Nobuyoshi Nakada 4d2ad8d737
Removed obsolete autoconf checks
Use regular `AC_CHECK_MEMBERS` instead of:
* `AC_STRUCT_ST_BLKSIZE`
* `AC_STRUCT_ST_BLOCKS`
* `AC_STRUCT_ST_RDEV`
2020-12-12 17:23:44 +09:00
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
Sorah Fukumori 7ccb7a992d
[DOC] explicit_bzero exists in modern Linux
[ci skip]
2020-04-26 02:00:45 +09:00
卜部昌平 4ff3f20540 add #include guard hack
According to MSVC manual (*1), cl.exe can skip including a header file
when that:

- contains #pragma once, or
- starts with #ifndef, or
- starts with #if ! defined.

GCC has a similar trick (*2), but it acts more stricter (e. g. there
must be _no tokens_ outside of #ifndef...#endif).

Sun C lacked #pragma once for a looong time.  Oracle Developer Studio
12.5 finally implemented it, but we cannot assume such recent version.

This changeset modifies header files so that each of them include
strictly one #ifndef...#endif.  I believe this is the most portable way
to trigger compiler optimizations. [Bug #16770]

*1: https://docs.microsoft.com/en-us/cpp/preprocessor/once
*2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
2020-04-13 16:06:00 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
卜部昌平 8184adabe5 internal/stdbool.h rework
Noticed that internal/stdbool.h and addr2line.c are the only two place
where missing/stdbool.h is included.  Why not delete the file so that
we can merge internal/stdbool.h and missing/stdbool.h into one.
2019-12-26 20:45:12 +09:00
Nobuyoshi Nakada e954be14d0
Get rid of false positive misspellings
[Bug #16437]
2019-12-24 10:33:32 +09:00
Nobuyoshi Nakada 209164e44f
Renamed assembly file like as e64f71f812 2019-11-18 18:42:22 +09:00
Yusuke Endoh cb14c4a535 missing/setproctitle.c: remove nonsense NULL check
If fmt is NULL, ptitle is uninitialized and used.
SETPROCTITLE(3bsd) says "If fmt is NULL, the process title is restored",
but looks like the feature is not implemented in missing/setproctitle.c.
At least the source code of ruby does not pass NULL to the function.
So I assume this function requires non-NULL fmt.

This issue was found by Coverity Scan.
2019-10-12 21:14:20 +09:00
Yusuke Endoh d76be10df1 missing/memcmp.c: suppress a `-Wparentheses` warning 2019-08-19 14:43:55 +09:00
David CARLIER 28267cea08 NetBSD native support of explicit_bzero's like feature (#2145) 2019-08-17 14:17:30 +09:00
nobu a67788b2f3 Split procstat_vm.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:13 +00:00
nobu 18365f9e83 Split mt19937.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:12 +00:00
nobu 867338c36e Split dtoa.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:11 +00:00
k0kubun d8931259d0 internal.h: unify our own stdtbool.h implementation
because we had another one in missing/stdbool.h as well.
Assuming that _Bool does not exist when stdbool.h is absent, I'm in
favor of r57462 implementation rather than r61326.

Note that Visual Studio 2013 has stdbool.h and thus r57462's commit
message is somewhat misleading. This missing/stdbool.h is for Visual
Studio 2012 or older, and for Oracle Solaris Studio 12.2 or older because
it's added in 12.3 https://docs.oracle.com/cd/E24457_01/html/E21987/gkeza.html.

missing/stdbool.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-06 14:53:43 +00:00
shyouhei 4680cecd57 [ci skip] tabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20 04:18:09 +00:00
shyouhei 782236e3bd add missing/nan.c
instead of scattering #ifdef HAVE_NANF here and there define our
own nan() unless defined elsewhere.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-20 03:16:59 +00:00
ngoto b75828fdfa Support C89 if possible
* addr2line.c: Because stdbool.h is a C99 feature, compile error
  occurs with some old compilers without specifying C99 options.
  Fix compile error with Oracle Solaris Studio 12.4 on Solaris 10.
  [Bug #14200] [ruby-dev:50366]

* missing/stdbool.h: Alternative of stdbool.h for C89 compilers.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-18 16:17:17 +00:00
rhe 0b845a8458 string.c: fix memory leak in String#crypt
Use ALLOCV to allocate struct crypt_data for slightly cleaner and less
error-prone code. It is currently possible it leaks when an invalid
argument is passed to String#crypt or rb_str_new_cstr() fails to
allocate memory.

SIZEOF_CRYPT_DATA macro in missing/crypt.h is removed since it is not
used any longer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12 15:55:04 +00:00
hsbt 0e2d2e6a79 Drop to support NaCl platform.
Because NaCl and PNaCl are already sunset status.
  see https://bugs.chromium.org/p/chromium/issues/detail?id=239656#c160

  configure.ac: Patch for this file was provided by @nobu.

  [Feature #14041][ruby-core:83497][fix GH-1726]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23 05:56:25 +00:00
nobu 92261511b6 string.c: for small crypt_data
* string.c (rb_str_crypt): struct crypt_data defined in
  missing/crypt.h is small enough.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 06:55:09 +00:00
nobu 126aba8587 fix tgamma for inifity
* configure.in: do not use buggy tgamma() of mingw.

* missing/tgamma.c (tgamma): merge fix for inifity from
  ruby_tgamma.  since msvcr120.dll and later have tgamma, this
  implementation will not be used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-12 16:12:46 +00:00
nobu 05ea264611 tgamma.c: unify versions with/without lgamma_r
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-12 16:01:17 +00:00
rhe 70c9bb4b81 Remove missing/strtol.c
It is never used. We don't need it anyway as it's part of C89 which is
our current minimum requirement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 06:03:12 +00:00
nobu 08cf4cecd5 get rid of sprintf
* missing/strerror.c (strerror): use snprintf instead of sprintf.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26 09:28:48 +00:00
nobu 9b454bfaf3 rubystub
* rubystub.c: generalize win32/stub.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-20 02:20:34 +00:00
hsbt 0b8590724d * missing/strl{cat,cpy}.c: Update latest upstream files.
[Misc #12205][ruby-core:74487]
* LEGAL: Update license for missing/strl{cat,cpy}.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-21 13:27:02 +00:00
nobu df8c48a3f9 Use LONG_LONG
* missing/crypt.h (B64): use LONG_LONG instead of long long
  directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-29 04:37:12 +00:00
nobu b1b1f3ded2 des_tables.c: generation rule
* defs/gmake.mk (missing/des_tables.c): move the recipe from
  common.mk.  this is less common.

* missing/crypt.c (init_des): if des_tables.c is empty, initialize
  DES tables at runtime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-04 02:40:04 +00:00
nobu 40c3c3ec6c crypt.h: remove initialized
* missing/crypt.h (struct crypt_data): remove unnecessary member
  "initialized".
* missing/crypt.c (des_setkey_r): nothing to be initialized in
  crypt_data.
* configure.in (struct crypt_data): check for "initialized" in
  struct crypt_data, which may be only in glibc, and isn't on AIX
  at least.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-04 01:54:54 +00:00
nobu 80cd6b8757 crypt.c: suppress warnings
* missing/crypt.c (SPE): make unsigned so that literal integers do
  not exceed 32bit signed integer limit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-02 03:05:40 +00:00
nobu 9334bb3075 crypt.c: fix syntax error on mswin
* missing/crypt.c (constdatablock): fix error on mswin. Visual C
  does not accept an empty initializer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-02 02:30:43 +00:00
nobu 5f225f3114 crypt.c: unused functions
* missing/crypt.c: suppress unused non-reentrant functions, by
  macro USE_NONREENTRANT_CRYPT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 13:38:59 +00:00
nobu 691556d778 crypt.h: get rid of conflict
* missing/crypt.h: move crypt.h to get rid of conflict with the
  system header.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-01 10:24:10 +00:00