summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-05-21 23:00:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-05-21 23:00:27 +0900
commit7f7a8fa555c3f12996114d13dc6908ea4e73c5b3 (patch)
treee7fb6eea87f7b7e19132edfd97824619b63e119c
parent08675889802be222ae01db7d0d54c7e1b45bffc5 (diff)
Put `rb_fork` back into process.c
Now, calling `rb_fork` directly breaks the PID cache and the timer thread, so must use `rb_fork_ruby` or similar instead.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7834
-rw-r--r--common.mk1
-rw-r--r--internal/process.h14
-rw-r--r--process.c11
-rw-r--r--ruby.c1
4 files changed, 11 insertions, 16 deletions
diff --git a/common.mk b/common.mk
index bfe0e1730d..4fc4143e48 100644
--- a/common.mk
+++ b/common.mk
@@ -13661,7 +13661,6 @@ ruby.$(OBJEXT): $(top_srcdir)/internal/loadpath.h
ruby.$(OBJEXT): $(top_srcdir)/internal/missing.h
ruby.$(OBJEXT): $(top_srcdir)/internal/object.h
ruby.$(OBJEXT): $(top_srcdir)/internal/parse.h
-ruby.$(OBJEXT): $(top_srcdir)/internal/process.h
ruby.$(OBJEXT): $(top_srcdir)/internal/serial.h
ruby.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
ruby.$(OBJEXT): $(top_srcdir)/internal/string.h
diff --git a/internal/process.h b/internal/process.h
index b9c52aebaa..fd4994cb4b 100644
--- a/internal/process.h
+++ b/internal/process.h
@@ -22,7 +22,6 @@
#include "ruby/ruby.h" /* for VALUE */
#include "internal/compilers.h" /* for __has_warning */
#include "internal/imemo.h" /* for RB_IMEMO_TMPBUF_PTR */
-#include "internal/warnings.h" /* for COMPILER_WARNING_PUSH */
#define RB_MAX_GROUPS (65536)
@@ -122,17 +121,4 @@ ARGVSTR2ARGC(VALUE argv_str)
return i - 1;
}
-#ifdef HAVE_WORKING_FORK
-COMPILER_WARNING_PUSH
-#if __has_warning("-Wdeprecated-declarations") || RBIMPL_COMPILER_IS(GCC)
-COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)
-#endif
-static inline rb_pid_t
-rb_fork(void)
-{
- return fork();
-}
-COMPILER_WARNING_POP
-#endif
-
#endif /* INTERNAL_PROCESS_H */
diff --git a/process.c b/process.c
index 7dbfca55f0..c54e11860e 100644
--- a/process.c
+++ b/process.c
@@ -1573,6 +1573,17 @@ after_fork_ruby(rb_pid_t pid)
#if defined(HAVE_WORKING_FORK)
+COMPILER_WARNING_PUSH
+#if __has_warning("-Wdeprecated-declarations") || RBIMPL_COMPILER_IS(GCC)
+COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)
+#endif
+static inline rb_pid_t
+rb_fork(void)
+{
+ return fork();
+}
+COMPILER_WARNING_POP
+
/* try_with_sh and exec_with_sh should be async-signal-safe. Actually it is.*/
#define try_with_sh(err, prog, argv, envp) ((err == ENOEXEC) ? exec_with_sh((prog), (argv), (envp)) : (void)0)
static void
diff --git a/ruby.c b/ruby.c
index 6e0e72bf55..ae974bfdec 100644
--- a/ruby.c
+++ b/ruby.c
@@ -54,7 +54,6 @@
#include "internal/missing.h"
#include "internal/object.h"
#include "internal/parse.h"
-#include "internal/process.h"
#include "internal/variable.h"
#include "ruby/encoding.h"
#include "ruby/thread.h"