From 5deec8ff1f84eaea82512c30f6abe0c6b7c4d784 Mon Sep 17 00:00:00 2001 From: Waldemar Kozaczuk Date: Sun, 19 May 2019 16:47:08 -0400 Subject: [PATCH] Move _post_main invocation to run_main This patch also fixes __libc_start_main() used for example by java to terminate any remaining app threads by _post_main. Signed-off-by: Waldemar Kozaczuk Message-Id: <20190519204708.16548-1-jwkozaczuk@gmail.com> --- core/app.cc | 8 ++++---- include/osv/app.hh | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/app.cc b/core/app.cc index fbd033aacf..e124353dfd 100644 --- a/core/app.cc +++ b/core/app.cc @@ -318,10 +318,6 @@ void application::main() if (_main) { run_main(); - - if(_post_main) { - _post_main(); - } } else { // The application is expected not to initialize the environment in // which it runs on its owns but to call __libc_start_main(). If that's @@ -421,6 +417,10 @@ void application::run_main() debug("program %s returned %d\n", _command.c_str(), _return_code); } + if(_post_main) { + _post_main(); + } + trace_app_main_ret(_return_code); } diff --git a/include/osv/app.hh b/include/osv/app.hh index 1f4d2d6d1b..d98ef4e530 100644 --- a/include/osv/app.hh +++ b/include/osv/app.hh @@ -216,7 +216,6 @@ private: void start(); void start_and_join(waiter* setup_waiter); void main(); - void run_main(std::string path, int argc, char** argv); void prepare_argv(elf::program *program); void run_main(); friend void ::__libc_start_main(int(*)(int, char**), int, char**, void(*)(),