1 /* Given a external process' id as argument, the program waits for a set timeout then attempts to abort that process */
2 /* Used by the Mono runtime's crash reporting. */
18 static char* program_name
;
19 void program_exit (int exit_code
, const char* message
);
21 int main (int argc
, char* argv
[])
23 program_name
= argv
[0];
25 program_exit (1, "Please provide one argument (pid)");
27 pid_t pid
= (pid_t
)strtoul (argv
[1], NULL
, 10);
29 program_exit (2, "Invalid pid");
33 /* if we survived the timeout, we consider the Mono process as hung */
36 /* just inform the user */
37 printf ("Mono process with pid %llu appears to be hung", (uint64_t)pid
);
40 printf ("Mono process hang detected, sending kill signal to pid %llu\n", (uint64_t)pid
);
41 return kill (pid
, SIGKILL
);
45 void program_exit (int exit_code
, const char* message
)
48 printf ("%s\n", message
);
49 printf ("Usage: '%s [pid]'\t\t[pid]: The id for the Mono process\n", program_name
);