summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-09-01 23:32:14 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-09-01 23:58:59 +0300
commit8ab50d3371a7106aa0d4327280fd97d98cdc65e5 (patch)
tree0d6a4f570cf93430fba8d4a83d1b57410162b9e5 /include
parent3ae3260af113fb3c3132b657655fbe40fec4b36e (diff)
downloadbdwgc-8ab50d3371a7106aa0d4327280fd97d98cdc65e5.tar.gz
Fix GC_proc_fd value in child process at fork (Solaris)
In case of PROC_VDB mode is initialized, GC_proc_fd contains a file descriptor to "/proc/<pid>/pagedata". After forking, the child process has a different pid value, thus the old file descriptor should be closed and the one with the updated file name should be opened in turn. * include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL && CAN_HANDLE_FORK] (GC_dirty_update_child): Declare (as a function or as a macro). * os_dep.c [PROC_VDB] (GC_proc_fd): Initialize to -1 (instead of 0). * os_dep.c [PROC_VDB] (proc_dirty_open_files): New static function (part of code is moved from GC_dirty_init). * os_dep.c [PROC_VDB && CAN_HANDLE_FORK] (GC_dirty_update_child): New GC_INNER function. * os_dep.c [PROC_VDB] (GC_dirty_init): Call proc_dirty_open_files(). * pthread_support.c [CAN_HANDLE_FORK && !GC_DISABLE_INCREMENTAL] (fork_child_proc): Call GC_dirty_update_child().
Diffstat (limited to 'include')
-rw-r--r--include/private/gc_priv.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 7b9bab1c..6685c07a 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -2416,6 +2416,17 @@ GC_EXTERN GC_bool GC_print_back_height;
/* pointer-free system call buffers in the heap are */
/* not protected. */
+# ifdef CAN_HANDLE_FORK
+# if defined(PROC_VDB)
+ GC_INNER void GC_dirty_update_child(void);
+ /* Update pid-specific resources (like /proc file */
+ /* descriptors) needed by the dirty bits implementation */
+ /* after fork in the child process. */
+# else
+# define GC_dirty_update_child() (void)0
+# endif
+# endif /* CAN_HANDLE_FORK */
+
GC_INNER GC_bool GC_dirty_init(void);
/* Returns true if dirty bits are maintained (otherwise */
/* it is OK to be called again if the client invokes */