Repository: mesos Updated Branches: refs/heads/master 5fd3174c6 -> 594ddb30c
Removed memcpy from os::Fork::instantiate. GCC 8.1 warns about using `memcpy` to copy a `os::Fork::Tree::Memory` struct because it doesn't have a trivial copy operator. We can replace the `memcpy` with direct access to the structure fields, which has the same effect. The struct was made a non-POD type in 4a01850c55, which introduced the `std::atomic_bool` member. Review: https://reviews.apache.org/r/67614/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/594ddb30 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/594ddb30 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/594ddb30 Branch: refs/heads/master Commit: 594ddb30cc9bced92d296d4e08a566e03378dd85 Parents: 5fd3174 Author: James Peach <[email protected]> Authored: Fri Jun 15 16:10:36 2018 -0700 Committer: James Peach <[email protected]> Committed: Fri Jun 15 16:10:36 2018 -0700 ---------------------------------------------------------------------- 3rdparty/stout/include/stout/os/posix/fork.hpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/594ddb30/3rdparty/stout/include/stout/os/posix/fork.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/os/posix/fork.hpp b/3rdparty/stout/include/stout/os/posix/fork.hpp index 098224e..83caaec 100644 --- a/3rdparty/stout/include/stout/os/posix/fork.hpp +++ b/3rdparty/stout/include/stout/os/posix/fork.hpp @@ -342,16 +342,12 @@ private: return pid; } - // Set the basic process information. - Tree::Memory process; - process.pid = getpid(); - process.parent = getppid(); - process.group = getpgid(0); - process.session = getsid(0); - process.set.store(true); - - // Copy it into shared memory. - memcpy(tree.memory.get(), &process, sizeof(Tree::Memory)); + // Set the basic process information into shared memory. + tree.memory->pid = getpid(); + tree.memory->parent = getppid(); + tree.memory->group = getpgid(0); + tree.memory->session = getsid(0); + tree.memory->set.store(true); // Execute the function, if any. if (function.isSome()) {
