Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:cgeb
ruby-railsexpress
03-fork-support-for-gc-logging.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 03-fork-support-for-gc-logging.patch of Package ruby-railsexpress
diff --git a/gc.c b/gc.c index 27d9177..7673687 100644 --- gc.c.orig +++ gc.c @@ -1193,6 +1193,34 @@ rb_gc_log_file(int argc, VALUE *argv, VALUE self) } /* + * Called from process.c before a fork. Flushes the gc log file to + * avoid writing the buffered output twice (once in the parent, and + * once in the child). + */ +void +rb_gc_before_fork() +{ + rb_objspace_t *objspace = &rb_objspace; + fflush(gc_data_file); +} + +/* + * Called from process.c after a fork in the child process. Turns off + * logging, disables GC stats and resets all gc counters and timing + * information. + */ +void +rb_gc_after_fork() +{ + rb_objspace_t *objspace = &rb_objspace; + rb_gc_disable_stats(); + rb_gc_clear_stats(); + rb_gc_disable_trace(); + gc_data_file = stderr; + rb_iv_set(rb_mGC, GC_LOGFILE_IVAR, Qnil); +} + +/* * call-seq: * GC.log String => String * diff --git a/include/ruby/intern.h b/include/ruby/intern.h index f0cff67..a374c7e 100644 --- include/ruby/intern.h.orig +++ include/ruby/intern.h @@ -390,6 +390,8 @@ void rb_gc_call_finalizer_at_exit(void); VALUE rb_gc_enable(void); VALUE rb_gc_disable(void); VALUE rb_gc_start(void); +void rb_gc_before_fork _((void)); +void rb_gc_after_fork _((void)); #define Init_stack(addr) ruby_init_stack(addr) /* hash.c */ void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t); diff --git a/process.c b/process.c index c180492..d20d44c 100644 --- process.c.orig +++ process.c @@ -2617,9 +2617,11 @@ rb_f_fork(VALUE obj) rb_pid_t pid; rb_secure(2); + rb_gc_before_fork(); switch (pid = rb_fork(0, 0, 0, Qnil)) { case 0: + rb_gc_after_fork(); rb_thread_atfork(); if (rb_block_given_p()) { int status;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor