MCPcopy Create free account
hub / github.com/ceph/ceph / run_command

Function run_command

src/common/module.c:37–59  ·  view source on GitHub ↗

* Return command's exit status or -1 on error. */

Source from the content-addressed store, hash-verified

35 * Return command's exit status or -1 on error.
36 */
37static int run_command(const char *command)
38{
39 int status;
40
41 status = system(command);
42 if (status >= 0 && WIFEXITED(status))
43 return WEXITSTATUS(status);
44
45 if (status < 0) {
46 char error_buf[80];
47 char* errp = ceph_strerror_r(errno, error_buf, sizeof(error_buf));
48 fprintf(stderr, "couldn't run '%s': %s\n", command,
49 errp);
50 } else if (WIFSIGNALED(status)) {
51 fprintf(stderr, "'%s' killed by signal %d\n", command,
52 WTERMSIG(status));
53 } else {
54 fprintf(stderr, "weird status from '%s': %d\n", command,
55 status);
56 }
57
58 return -1;
59}
60
61int module_has_param(const char *module, const char *param)
62{

Callers 3

module_has_paramFunction · 0.70
module_loadFunction · 0.70
gather_socket_outputMethod · 0.50

Calls 2

systemFunction · 0.85
ceph_strerror_rFunction · 0.85

Tested by 1

gather_socket_outputMethod · 0.40