diff mbox

Fix two functions of the same name

Message ID CANycmrrGm0N50_0xo91iPkdMirpeWiyXKw97wQaL0sTX7-m=Cg@mail.gmail.com
State New
Headers show

Commit Message

Lb peace June 13, 2014, 11:49 a.m. UTC
It is funny that we have two sigbus_handler in our QEMU.(exec.c &
cpus.c)Change one's name.

Signed-off-by: Peace <peacelb@gmail.com)>
---
 cpus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

     if (kvm_on_sigbus(siginfo->ssi_code,
@@ -598,7 +598,7 @@ static void qemu_init_sigbus(void)

     memset(&action, 0, sizeof(action));
     action.sa_flags = SA_SIGINFO;
-    action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
+    action.sa_sigaction = (void (*)(int, siginfo_t*,
void*))default_sigbus_handler;
     sigaction(SIGBUS, &action, NULL);

     prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);

Comments

Stefan Weil June 13, 2014, 5:05 p.m. UTC | #1
Am 13.06.2014 13:49, schrieb Lb peace:
> It is funny that we have two sigbus_handler in our QEMU.(exec.c &
> cpus.c)Change one's name.
> 
> Signed-off-by: Peace <peacelb@gmail.com)>
> ---
>  cpus.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 

Technically it does not matter whether two functions have the same name
as long as both are in different compilation units (*.c files) and have
only a local scope (that's what the 'static' keyword does).

There are even function names in QEMU code which occur three or more
times. Look for register_types, for example.

They do you think this should be changed? The only reason I see is that
setting breakpoints while debugging is a little bit more difficult.

Regards
Stefan
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index dd7ac13..2a429e5 100644
--- a/cpus.c
+++ b/cpus.c
@@ -583,7 +583,7 @@  static void sigbus_reraise(void)
     abort();
 }

-static void sigbus_handler(int n, struct qemu_signalfd_siginfo *siginfo,
+static void default_sigbus_handler(int n, struct qemu_signalfd_siginfo
*siginfo,
                            void *ctx)
 {