Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Apply a fix similar to 6b16991 'ps -p', no space before dash-p option ar... #94

Merged
merged 1 commit into from

2 participants

@walquis

...gs; also needed for the '-o' option of ps. Tested on Ubuntu 11.04 vm. Without this fix, the passenger logfile grows out of control.

@walquis walquis Apply a fix similar to 6b16991 'ps -p', no space before dash-p option…
… args; also needed for the '-o' option of ps. Tested on Ubuntu 11.04 vm. Without this fix, the passenger logfile grows out of control.
f55f1f5
@FooBarWidget FooBarWidget merged commit 8118630 into phusion:master
@FooBarWidget
Owner

I've confirmed that this syntax also works on OS X and on Solaris. Thank you for this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 1, 2014
  1. @walquis

    Apply a fix similar to 6b16991 'ps -p', no space before dash-p option…

    walquis authored
    … args; also needed for the '-o' option of ps. Tested on Ubuntu 11.04 vm. Without this fix, the passenger logfile grows out of control.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 6 deletions.
  1. +9 −6 ext/common/Utils/ProcessMetricsCollector.h
View
15 ext/common/Utils/ProcessMetricsCollector.h
@@ -450,14 +450,16 @@ class ProcessMetricsCollector {
if (pidsArg[pidsArg.size() - 1] == ',') {
pidsArg.resize(pidsArg.size() - 1);
}
+
+ string fmtArg = "-o";
+ #if defined(sun) || defined(__sun)
+ fmtArg.append("pid,ppid,pcpu,rss,vsz,pgid,uid,args");
+ #else
+ fmtArg.append("pid,ppid,%cpu,rss,vsize,pgid,uid,command");
+ #endif
const char *command[] = {
- "ps", "-o",
- #if defined(sun) || defined(__sun)
- "pid,ppid,pcpu,rss,vsz,pgid,uid,args",
- #else
- "pid,ppid,%cpu,rss,vsize,pgid,uid,command",
- #endif
+ "ps", fmtArg.c_str(),
#ifdef PS_SUPPORTS_MULTIPLE_PIDS
pidsArg.c_str(),
#endif
@@ -469,6 +471,7 @@ class ProcessMetricsCollector {
psOutput = runCommandAndCaptureOutput(command);
}
pidsArg.resize(0);
+ fmtArg.resize(0);
ProcessMetricMap result = parsePsOutput<Collection, ConstIterator>(psOutput, pids);
psOutput.resize(0);
if (canMeasureRealMemory) {
Something went wrong with that request. Please try again.