Skip to content

Commit

Permalink
Merge pull request opsengine#13 from opsengine/issue_8
Browse files Browse the repository at this point in the history
Option --ignore-children replaced with --include-children
  • Loading branch information
opsengine committed Jul 8, 2012
2 parents f209b18 + d1bd2ee commit 1404058
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cpulimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void print_usage(FILE *stream, int exit_code)
fprintf(stream, " -l, --limit=N percentage of cpu allowed from 0 to %d (required)\n", 100*NCPU);
fprintf(stream, " -v, --verbose show control statistics\n");
fprintf(stream, " -z, --lazy exit if there is no target process, or if it dies\n");
fprintf(stream, " -i, --ignore-children don't limit children processes\n");
fprintf(stream, " -i, --include-children limit also the children processes\n");
fprintf(stream, " -h, --help display this help and exit\n");
fprintf(stream, " TARGET must be exactly one of these:\n");
fprintf(stream, " -p, --pid=N pid of the process (implies -z)\n");
Expand Down Expand Up @@ -307,7 +307,7 @@ int main(int argc, char **argv) {
int pid_ok = 0;
int limit_ok = 0;
pid_t pid = 0;
int ignore_children = 0;
int include_children = 0;

//get program name
char *p = (char*)memrchr(argv[0], (unsigned int)'/', strlen(argv[0]));
Expand All @@ -329,7 +329,7 @@ int main(int argc, char **argv) {
{ "limit", required_argument, NULL, 'l' },
{ "verbose", no_argument, NULL, 'v' },
{ "lazy", no_argument, NULL, 'z' },
{ "ignore-children", no_argument, NULL, 'i' },
{ "include-children", no_argument, NULL, 'i' },
{ "help", no_argument, NULL, 'h' },
{ 0, 0, 0, 0 }
};
Expand All @@ -356,7 +356,7 @@ int main(int argc, char **argv) {
lazy = 1;
break;
case 'i':
ignore_children = 1;
include_children = 1;
break;
case 'h':
print_usage(stdout, 1);
Expand Down Expand Up @@ -466,7 +466,7 @@ int main(int argc, char **argv) {
else {
//limiter code
if (verbose) printf("Limiting process %d\n",child);
limit_process(child, limit, !ignore_children);
limit_process(child, limit, include_children);
exit(0);
}
}
Expand Down Expand Up @@ -505,7 +505,7 @@ int main(int argc, char **argv) {
}
printf("Process %d found\n", pid);
//control
limit_process(pid, limit, ignore_children);
limit_process(pid, limit, include_children);
}
if (lazy) break;
sleep(2);
Expand Down

0 comments on commit 1404058

Please sign in to comment.