MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / main

Function main

extra/mysql_waitpid.c:61–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59
60
61int main(int argc, char *argv[])
62{
63 int pid= 0, t= 0, sig= 0;
64
65 progname= argv[0];
66
67 fprintf(stderr,
68 "Warning: %s is deprecated and will be removed in a future version.\n",
69 progname);
70
71 if (handle_options(&argc, &argv, my_long_options, get_one_option))
72 exit(-1);
73 if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
74 (t= atoi(argv[1])) <= 0)
75 usage();
76 for (; t > 0; t--)
77 {
78 if (kill((pid_t) pid, sig))
79 {
80 if (errno == EINVAL)
81 {
82 if (verbose)
83 printf("WARNING: kill couldn't handle signal 0, using signal 1.\n");
84 sig= 1;
85 t++;
86 continue;
87 }
88 return 0;
89 }
90 sleep(1);
91 }
92 return 1;
93}
94
95void usage(void)
96{

Callers

nothing calls this directly

Calls 3

handle_optionsFunction · 0.85
atoiFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected