Kernel: Process keeps track if forked process has called exec*()

This commit is contained in:
Bananymous 2023-08-22 14:53:46 +03:00
parent 97ea4986af
commit f1ba5c7e0f
2 changed files with 5 additions and 0 deletions

View File

@ -180,6 +180,8 @@ namespace Kernel
userspace_info_t m_userspace_info; userspace_info_t m_userspace_info;
ExitStatus m_exit_status; ExitStatus m_exit_status;
bool m_has_called_exec { false };
BAN::UniqPtr<PageTable> m_page_table; BAN::UniqPtr<PageTable> m_page_table;
BAN::RefPtr<TTY> m_controlling_terminal; BAN::RefPtr<TTY> m_controlling_terminal;

View File

@ -381,6 +381,7 @@ namespace Kernel
forked->m_general_allocator = BAN::move(general_allocator); forked->m_general_allocator = BAN::move(general_allocator);
forked->m_is_userspace = m_is_userspace; forked->m_is_userspace = m_is_userspace;
forked->m_userspace_info = m_userspace_info; forked->m_userspace_info = m_userspace_info;
forked->m_has_called_exec = false;
memcpy(forked->m_signal_handlers, m_signal_handlers, sizeof(m_signal_handlers)); memcpy(forked->m_signal_handlers, m_signal_handlers, sizeof(m_signal_handlers));
ASSERT(this == &Process::current()); ASSERT(this == &Process::current());
@ -586,6 +587,8 @@ namespace Kernel
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
} }
m_has_called_exec = true;
} }
BAN::ErrorOr<long> Process::sys_open(BAN::StringView path, int flags, mode_t mode) BAN::ErrorOr<long> Process::sys_open(BAN::StringView path, int flags, mode_t mode)