passenger 5.0.23 → 5.0.24
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG +16 -1
- data/bin/passenger-install-apache2-module +1 -1
- data/build/basics.rb +1 -1
- data/build/cplusplus_support.rb +1 -1
- data/build/integration_tests.rb +1 -1
- data/build/packaging.rb +1 -1
- data/resources/templates/standalone/http.erb +1 -0
- data/src/agent/Core/ApiServer.h +91 -38
- data/src/agent/Core/ApplicationPool/Pool.h +2 -1
- data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +2 -1
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +28 -1
- data/src/agent/Core/ApplicationPool/Process.h +3 -0
- data/src/agent/Core/Controller/CheckoutSession.cpp +2 -2
- data/src/agent/Core/Controller/ForwardResponse.cpp +1 -1
- data/src/agent/Core/Controller/Request.h +2 -2
- data/src/agent/Core/CoreMain.cpp +3 -2
- data/src/agent/Core/OptionParser.h +5 -0
- data/src/agent/Core/UnionStation/StopwatchLog.h +34 -60
- data/src/agent/UstRouter/ApiServer.h +27 -14
- data/src/apache2_module/Configuration.cpp +6 -0
- data/src/apache2_module/Configuration.hpp +4 -0
- data/src/apache2_module/Hooks.cpp +1 -0
- data/src/cxx_supportlib/Constants.h +3 -1
- data/src/cxx_supportlib/ServerKit/FdSinkChannel.h +1 -1
- data/src/cxx_supportlib/Utils.cpp +1 -1
- data/src/nginx_module/CacheLocationConfig.c +26 -0
- data/src/nginx_module/Configuration.c +5 -0
- data/src/nginx_module/Configuration.h +1 -0
- data/src/nginx_module/ConfigurationCommands.c +10 -0
- data/src/nginx_module/ConfigurationFields.h +2 -0
- data/src/nginx_module/CreateLocationConfig.c +4 -0
- data/src/nginx_module/MergeLocationConfig.c +6 -0
- data/src/nginx_module/ngx_http_passenger_module.c +1 -0
- data/src/ruby_supportlib/phusion_passenger.rb +3 -3
- data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +11 -11
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +3 -3
- data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +30 -10
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +7 -7
- data/src/ruby_supportlib/phusion_passenger/platform_info/binary_compatibility.rb +3 -3
- data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +8 -8
- data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +7 -7
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger/platform_info/linux.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/openssl.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +22 -9
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/ruby_core_enhancements.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +14 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- metadata +3 -2
@@ -49,17 +49,7 @@ using namespace boost;
|
|
49
49
|
class StopwatchLog: public noncopyable {
|
50
50
|
private:
|
51
51
|
Transaction * const transaction;
|
52
|
-
|
53
|
-
const char *name;
|
54
|
-
struct {
|
55
|
-
const char *endMessage;
|
56
|
-
const char *abortMessage;
|
57
|
-
} granular;
|
58
|
-
} data;
|
59
|
-
enum {
|
60
|
-
NAME,
|
61
|
-
GRANULAR
|
62
|
-
} type: 1;
|
52
|
+
const char *id;
|
63
53
|
bool ok;
|
64
54
|
|
65
55
|
static string timevalToString(struct timeval &tv) {
|
@@ -78,20 +68,19 @@ public:
|
|
78
68
|
: transaction(NULL)
|
79
69
|
{ }
|
80
70
|
|
81
|
-
StopwatchLog(const TransactionPtr &_transaction, const char *
|
71
|
+
StopwatchLog(const TransactionPtr &_transaction, const char *id, const char *nameAndData)
|
82
72
|
: transaction(_transaction.get())
|
83
73
|
{
|
84
|
-
|
85
|
-
data.name = name;
|
74
|
+
this->id = id;
|
86
75
|
ok = false;
|
87
76
|
|
88
|
-
char message[
|
77
|
+
char message[250];
|
89
78
|
char *pos = message;
|
90
79
|
const char *end = message + sizeof(message);
|
91
80
|
struct rusage usage;
|
92
81
|
|
93
82
|
pos = appendData(pos, end, "BEGIN: ");
|
94
|
-
pos = appendData(pos, end,
|
83
|
+
pos = appendData(pos, end, id);
|
95
84
|
pos = appendData(pos, end, " (");
|
96
85
|
pos = appendData(pos, end, usecToString(uv_hrtime() / 1000));
|
97
86
|
pos = appendData(pos, end, ",");
|
@@ -104,23 +93,16 @@ public:
|
|
104
93
|
pos = appendData(pos, end, timevalToString(usage.ru_stime));
|
105
94
|
pos = appendData(pos, end, ") ");
|
106
95
|
|
107
|
-
if (
|
108
|
-
|
96
|
+
if (nameAndData != NULL) {
|
97
|
+
try {
|
98
|
+
pos = appendData(pos, end, modp::b64_encode(nameAndData));
|
99
|
+
} catch (const std::runtime_error &) {
|
100
|
+
// non-fatal: ignore
|
101
|
+
}
|
109
102
|
}
|
110
|
-
}
|
111
103
|
|
112
|
-
|
113
|
-
|
114
|
-
const char *endMessage,
|
115
|
-
const char *abortMessage = NULL)
|
116
|
-
: transaction(_transaction.get())
|
117
|
-
{
|
118
|
-
if (_transaction != NULL) {
|
119
|
-
type = GRANULAR;
|
120
|
-
data.granular.endMessage = endMessage;
|
121
|
-
data.granular.abortMessage = abortMessage;
|
122
|
-
ok = abortMessage == NULL;
|
123
|
-
_transaction->message(beginMessage);
|
104
|
+
if (transaction != NULL) {
|
105
|
+
transaction->message(StaticString(message, pos - message));
|
124
106
|
}
|
125
107
|
}
|
126
108
|
|
@@ -128,38 +110,30 @@ public:
|
|
128
110
|
if (transaction == NULL) {
|
129
111
|
return;
|
130
112
|
}
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
struct rusage usage;
|
136
|
-
|
137
|
-
if (ok) {
|
138
|
-
pos = appendData(pos, end, "END: ");
|
139
|
-
} else {
|
140
|
-
pos = appendData(pos, end, "FAIL: ");
|
141
|
-
}
|
142
|
-
pos = appendData(pos, end, data.name);
|
143
|
-
pos = appendData(pos, end, " (");
|
144
|
-
pos = appendData(pos, end, usecToString(uv_hrtime() / 1000));
|
145
|
-
pos = appendData(pos, end, ",");
|
146
|
-
if (getrusage(RUSAGE_SELF, &usage) == -1) {
|
147
|
-
int e = errno;
|
148
|
-
throw SystemException("getrusage() failed", e);
|
149
|
-
}
|
150
|
-
pos = appendData(pos, end, timevalToString(usage.ru_utime));
|
151
|
-
pos = appendData(pos, end, ",");
|
152
|
-
pos = appendData(pos, end, timevalToString(usage.ru_stime));
|
153
|
-
pos = appendData(pos, end, ")");
|
113
|
+
char message[150];
|
114
|
+
char *pos = message;
|
115
|
+
const char *end = message + sizeof(message);
|
116
|
+
struct rusage usage;
|
154
117
|
|
155
|
-
|
118
|
+
if (ok) {
|
119
|
+
pos = appendData(pos, end, "END: ");
|
156
120
|
} else {
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
121
|
+
pos = appendData(pos, end, "FAIL: ");
|
122
|
+
}
|
123
|
+
pos = appendData(pos, end, id);
|
124
|
+
pos = appendData(pos, end, " (");
|
125
|
+
pos = appendData(pos, end, usecToString(uv_hrtime() / 1000));
|
126
|
+
pos = appendData(pos, end, ",");
|
127
|
+
if (getrusage(RUSAGE_SELF, &usage) == -1) {
|
128
|
+
int e = errno;
|
129
|
+
throw SystemException("getrusage() failed", e);
|
162
130
|
}
|
131
|
+
pos = appendData(pos, end, timevalToString(usage.ru_utime));
|
132
|
+
pos = appendData(pos, end, ",");
|
133
|
+
pos = appendData(pos, end, timevalToString(usage.ru_stime));
|
134
|
+
pos = appendData(pos, end, ")");
|
135
|
+
|
136
|
+
transaction->message(StaticString(message, pos - message));
|
163
137
|
}
|
164
138
|
|
165
139
|
void success() {
|
@@ -171,26 +171,39 @@ private:
|
|
171
171
|
}
|
172
172
|
}
|
173
173
|
|
174
|
-
|
175
|
-
|
174
|
+
void gatherControllerState(Client *client, Request *req, Controller *controller) {
|
175
|
+
Json::Value state = controller->inspectStateAsJson();
|
176
|
+
getContext()->libev->runLater(boost::bind(&ApiServer::controllerStateGathered,
|
177
|
+
this, client, req, state));
|
178
|
+
}
|
179
|
+
|
180
|
+
void controllerStateGathered(Client *client, Request *req, Json::Value state) {
|
181
|
+
if (req->ended()) {
|
182
|
+
unrefRequest(req, __FILE__, __LINE__);
|
183
|
+
return;
|
184
|
+
}
|
185
|
+
|
186
|
+
HeaderTable headers;
|
187
|
+
headers.insert(req->pool, "Content-Type", "application/json");
|
188
|
+
|
189
|
+
writeSimpleResponse(client, 200, &headers,
|
190
|
+
psg_pstrdup(req->pool, state.toStyledString()));
|
191
|
+
if (!req->ended()) {
|
192
|
+
Request *req2 = req;
|
193
|
+
endRequest(&client, &req2);
|
194
|
+
}
|
195
|
+
|
196
|
+
unrefRequest(req, __FILE__, __LINE__);
|
176
197
|
}
|
177
198
|
|
178
199
|
void processServerStatus(Client *client, Request *req) {
|
179
200
|
if (req->method != HTTP_GET) {
|
180
201
|
apiServerRespondWith405(this, client, req);
|
181
202
|
} else if (authorizeStateInspectionOperation(this, client, req)) {
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
controller->getContext()->libev->runSync(boost::bind(
|
187
|
-
inspectControllerState, controller, &json));
|
188
|
-
|
189
|
-
writeSimpleResponse(client, 200, &headers,
|
190
|
-
psg_pstrdup(req->pool, json.toStyledString()));
|
191
|
-
if (!req->ended()) {
|
192
|
-
endRequest(&client, &req);
|
193
|
-
}
|
203
|
+
refRequest(req, __FILE__, __LINE__);
|
204
|
+
controller->getContext()->libev->runLater(boost::bind(
|
205
|
+
&ApiServer::gatherControllerState, this,
|
206
|
+
client, req, controller));
|
194
207
|
} else {
|
195
208
|
apiServerRespondWith401(this, client, req);
|
196
209
|
}
|
@@ -237,6 +237,7 @@ DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_root, root)
|
|
237
237
|
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_default_ruby, defaultRuby)
|
238
238
|
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_log_level, logLevel, unsigned int, 0)
|
239
239
|
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_log_file, logFile)
|
240
|
+
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_socket_backlog, socketBacklog, unsigned int, 0)
|
240
241
|
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_file_descriptor_log_file, fileDescriptorLogFile)
|
241
242
|
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_max_pool_size, maxPoolSize, unsigned int, 1)
|
242
243
|
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_pool_idle_time, poolIdleTime, unsigned int, 0)
|
@@ -403,6 +404,11 @@ const command_rec passenger_commands[] = {
|
|
403
404
|
NULL,
|
404
405
|
RSRC_CONF,
|
405
406
|
"Passenger log file."),
|
407
|
+
AP_INIT_TAKE1("PassengerSocketBacklog",
|
408
|
+
(Take1Func) cmd_passenger_socket_backlog,
|
409
|
+
NULL,
|
410
|
+
RSRC_CONF,
|
411
|
+
"Override size of the socket backlog."),
|
406
412
|
AP_INIT_TAKE1("PassengerFileDescriptorLogFile",
|
407
413
|
(Take1Func) cmd_passenger_file_descriptor_log_file,
|
408
414
|
NULL,
|
@@ -168,6 +168,9 @@ struct ServerConfig {
|
|
168
168
|
const char *logFile;
|
169
169
|
const char *fileDescriptorLogFile;
|
170
170
|
|
171
|
+
/** Socket backlog for Passenger Core server socket */
|
172
|
+
unsigned int socketBacklog;
|
173
|
+
|
171
174
|
/** The maximum number of simultaneously alive application
|
172
175
|
* instances. */
|
173
176
|
unsigned int maxPoolSize;
|
@@ -210,6 +213,7 @@ struct ServerConfig {
|
|
210
213
|
logLevel = DEFAULT_LOG_LEVEL;
|
211
214
|
logFile = NULL;
|
212
215
|
fileDescriptorLogFile = NULL;
|
216
|
+
socketBacklog = DEFAULT_SOCKET_BACKLOG;
|
213
217
|
maxPoolSize = DEFAULT_MAX_POOL_SIZE;
|
214
218
|
poolIdleTime = DEFAULT_POOL_IDLE_TIME;
|
215
219
|
responseBufferHighWatermark = DEFAULT_RESPONSE_BUFFER_HIGH_WATERMARK;
|
@@ -1296,6 +1296,7 @@ public:
|
|
1296
1296
|
.setBool("load_shell_envvars", true)
|
1297
1297
|
.set ("file_descriptor_log_file", (serverConfig.fileDescriptorLogFile == NULL)
|
1298
1298
|
? "" : serverConfig.fileDescriptorLogFile)
|
1299
|
+
.setInt ("socket_backlog", serverConfig.socketBacklog)
|
1299
1300
|
.set ("data_buffer_dir", serverConfig.dataBufferDir)
|
1300
1301
|
.set ("instance_registry_dir", serverConfig.instanceRegistryDir)
|
1301
1302
|
.setBool("user_switching", serverConfig.userSwitching)
|
@@ -83,6 +83,8 @@
|
|
83
83
|
|
84
84
|
#define DEFAULT_RUBY "ruby"
|
85
85
|
|
86
|
+
#define DEFAULT_SOCKET_BACKLOG 1024
|
87
|
+
|
86
88
|
#define DEFAULT_SPAWN_METHOD "smart"
|
87
89
|
|
88
90
|
#define DEFAULT_START_TIMEOUT 90000
|
@@ -119,7 +121,7 @@
|
|
119
121
|
|
120
122
|
#define PASSENGER_DEFAULT_USER "nobody"
|
121
123
|
|
122
|
-
#define PASSENGER_VERSION "5.0.
|
124
|
+
#define PASSENGER_VERSION "5.0.24"
|
123
125
|
|
124
126
|
#define POOL_HELPER_THREAD_STACK_SIZE 262144
|
125
127
|
|
@@ -54,7 +54,7 @@ private:
|
|
54
54
|
|
55
55
|
do {
|
56
56
|
ret = ::write(watcher.fd, buffer.start, buffer.size());
|
57
|
-
} while (ret == -1 && errno ==
|
57
|
+
} while (ret == -1 && errno == EINTR);
|
58
58
|
if (ret == (ssize_t) buffer.size()) {
|
59
59
|
return Result(ret, false);
|
60
60
|
} else if (ret >= 0) {
|
@@ -1313,7 +1313,7 @@ getHighestFileDescriptor(bool asyncSignalSafe) {
|
|
1313
1313
|
|
1314
1314
|
do {
|
1315
1315
|
ret = read(p[0], u.data + bytesRead, sizeof(int) - bytesRead);
|
1316
|
-
} while (ret == -1 &&
|
1316
|
+
} while (ret == -1 && errno == EINTR);
|
1317
1317
|
if (ret == -1) {
|
1318
1318
|
if (errno != EAGAIN) {
|
1319
1319
|
goto done;
|
@@ -47,6 +47,18 @@ int generated_cache_location_part(ngx_conf_t *cf, passenger_loc_conf_t *conf) {
|
|
47
47
|
/* Calculate lengths */
|
48
48
|
|
49
49
|
|
50
|
+
if (conf->socket_backlog != NGX_CONF_UNSET) {
|
51
|
+
end = ngx_snprintf(int_buf,
|
52
|
+
sizeof(int_buf) - 1,
|
53
|
+
"%d",
|
54
|
+
conf->socket_backlog);
|
55
|
+
len += sizeof("!~PASSENGER_SOCKET_BACKLOG: ") - 1;
|
56
|
+
len += end - int_buf;
|
57
|
+
len += sizeof("\r\n") - 1;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
|
50
62
|
if (conf->ruby.data != NULL) {
|
51
63
|
len += sizeof("!~PASSENGER_RUBY: ") - 1;
|
52
64
|
len += conf->ruby.len;
|
@@ -333,6 +345,20 @@ if (buf == NULL) {
|
|
333
345
|
|
334
346
|
|
335
347
|
|
348
|
+
if (conf->socket_backlog != NGX_CONF_UNSET) {
|
349
|
+
pos = ngx_copy(pos,
|
350
|
+
"!~PASSENGER_SOCKET_BACKLOG: ",
|
351
|
+
sizeof("!~PASSENGER_SOCKET_BACKLOG: ") - 1);
|
352
|
+
end = ngx_snprintf(int_buf,
|
353
|
+
sizeof(int_buf) - 1,
|
354
|
+
"%d",
|
355
|
+
conf->socket_backlog);
|
356
|
+
pos = ngx_copy(pos, int_buf, end - int_buf);
|
357
|
+
pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
|
358
|
+
}
|
359
|
+
|
360
|
+
|
361
|
+
|
336
362
|
if (conf->ruby.data != NULL) {
|
337
363
|
pos = ngx_copy(pos,
|
338
364
|
"!~PASSENGER_RUBY: ",
|
@@ -86,6 +86,7 @@ passenger_create_main_conf(ngx_conf_t *cf)
|
|
86
86
|
conf->log_level = (ngx_int_t) NGX_CONF_UNSET;
|
87
87
|
conf->log_file.data = NULL;
|
88
88
|
conf->log_file.len = 0;
|
89
|
+
conf->socket_backlog = NGX_CONF_UNSET_UINT;
|
89
90
|
conf->file_descriptor_log_file.data = NULL;
|
90
91
|
conf->file_descriptor_log_file.len = 0;
|
91
92
|
conf->data_buffer_dir.data = NULL;
|
@@ -152,6 +153,10 @@ passenger_init_main_conf(ngx_conf_t *cf, void *conf_pointer)
|
|
152
153
|
conf->file_descriptor_log_file.data = (u_char *) "";
|
153
154
|
}
|
154
155
|
|
156
|
+
if (conf->socket_backlog == NGX_CONF_UNSET_UINT) {
|
157
|
+
conf->socket_backlog = DEFAULT_SOCKET_BACKLOG;
|
158
|
+
}
|
159
|
+
|
155
160
|
if (conf->data_buffer_dir.len == 0) {
|
156
161
|
conf->data_buffer_dir.data = (u_char *) "";
|
157
162
|
}
|
@@ -40,6 +40,16 @@
|
|
40
40
|
|
41
41
|
|
42
42
|
|
43
|
+
{
|
44
|
+
|
45
|
+
ngx_string("passenger_socket_backlog"),
|
46
|
+
NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
|
47
|
+
ngx_conf_set_num_slot,
|
48
|
+
NGX_HTTP_MAIN_CONF_OFFSET,
|
49
|
+
offsetof(passenger_main_conf_t, socket_backlog),
|
50
|
+
NULL
|
51
|
+
},
|
52
|
+
|
43
53
|
{
|
44
54
|
|
45
55
|
ngx_string("passenger_enabled"),
|
@@ -43,6 +43,12 @@ int generated_merge_part(passenger_loc_conf_t *conf, passenger_loc_conf_t *prev,
|
|
43
43
|
|
44
44
|
|
45
45
|
|
46
|
+
ngx_conf_merge_value(conf->socket_backlog,
|
47
|
+
prev->socket_backlog,
|
48
|
+
NGX_CONF_UNSET);
|
49
|
+
|
50
|
+
|
51
|
+
|
46
52
|
ngx_conf_merge_value(conf->enabled,
|
47
53
|
prev->enabled,
|
48
54
|
NGX_CONF_UNSET);
|
@@ -284,6 +284,7 @@ start_watchdog(ngx_cycle_t *cycle) {
|
|
284
284
|
psg_variant_map_set_bool (params, "load_shell_envvars", 1);
|
285
285
|
psg_variant_map_set_int (params, "log_level", passenger_main_conf.log_level);
|
286
286
|
psg_variant_map_set_ngx_str(params, "file_descriptor_log_file", &passenger_main_conf.file_descriptor_log_file);
|
287
|
+
psg_variant_map_set_int (params, "socket_backlog", passenger_main_conf.socket_backlog);
|
287
288
|
psg_variant_map_set_ngx_str(params, "data_buffer_dir", &passenger_main_conf.data_buffer_dir);
|
288
289
|
psg_variant_map_set_ngx_str(params, "instance_registry_dir", &passenger_main_conf.instance_registry_dir);
|
289
290
|
psg_variant_map_set_bool (params, "user_switching", passenger_main_conf.user_switching);
|
@@ -31,10 +31,10 @@ module PhusionPassenger
|
|
31
31
|
|
32
32
|
PACKAGE_NAME = 'passenger'
|
33
33
|
# Run 'rake src/cxx_supportlib/Constants.h' after changing this number.
|
34
|
-
VERSION_STRING = '5.0.
|
34
|
+
VERSION_STRING = '5.0.24'
|
35
35
|
|
36
|
-
PREFERRED_NGINX_VERSION = '1.8.
|
37
|
-
NGINX_SHA256_CHECKSUM = '
|
36
|
+
PREFERRED_NGINX_VERSION = '1.8.1'
|
37
|
+
NGINX_SHA256_CHECKSUM = '8f4b3c630966c044ec72715754334d1fdf741caa1d5795fb4646c27d09f797b7'
|
38
38
|
|
39
39
|
PREFERRED_PCRE_VERSION = '8.34'
|
40
40
|
PCRE_SHA256_CHECKSUM = '1dd78994c81e44ac41cf30b2a21d4b4cc6d76ccde7fc6e77713ed51d7bddca47'
|
@@ -118,7 +118,7 @@ module PhusionPassenger
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def platform_provides_private_dirty_rss_information?
|
121
|
-
return
|
121
|
+
return os_name_simple == "linux"
|
122
122
|
end
|
123
123
|
|
124
124
|
# Returns whether root privileges are required in order to measure private dirty RSS.
|
@@ -138,8 +138,8 @@ module PhusionPassenger
|
|
138
138
|
# if the system's RAM usage cannot be determined.
|
139
139
|
def system_ram_usage
|
140
140
|
@total_system_ram ||= begin
|
141
|
-
case
|
142
|
-
when
|
141
|
+
case os_name_simple
|
142
|
+
when "linux"
|
143
143
|
free_text = `free -k`
|
144
144
|
|
145
145
|
free_text =~ %r{Mem:(.+)$}
|
@@ -151,7 +151,7 @@ module PhusionPassenger
|
|
151
151
|
used = line.split(/ +/).first.to_i
|
152
152
|
|
153
153
|
[total, used]
|
154
|
-
when
|
154
|
+
when "macosx"
|
155
155
|
vm_stat = `vm_stat`
|
156
156
|
vm_stat =~ /page size of (\d+) bytes/
|
157
157
|
page_size = $1
|
@@ -202,8 +202,8 @@ module PhusionPassenger
|
|
202
202
|
end
|
203
203
|
|
204
204
|
private
|
205
|
-
def
|
206
|
-
return PlatformInfo.
|
205
|
+
def os_name_simple
|
206
|
+
return PlatformInfo.os_name_simple
|
207
207
|
end
|
208
208
|
|
209
209
|
# Returns a list of Process objects that match the given search criteria.
|
@@ -219,14 +219,14 @@ module PhusionPassenger
|
|
219
219
|
def list_processes(options)
|
220
220
|
if options[:exe]
|
221
221
|
name = options[:exe].sub(/.*\/(.*)/, '\1')
|
222
|
-
if
|
222
|
+
if os_name_simple == "linux"
|
223
223
|
ps = "ps -C '#{name}'"
|
224
224
|
else
|
225
225
|
ps = "ps -A"
|
226
226
|
options[:match] = Regexp.new(Regexp.escape(name))
|
227
227
|
end
|
228
228
|
elsif options[:name]
|
229
|
-
if
|
229
|
+
if os_name_simple == "linux"
|
230
230
|
ps = "ps -C '#{options[:name]}'"
|
231
231
|
else
|
232
232
|
ps = "ps -A"
|
@@ -239,11 +239,11 @@ module PhusionPassenger
|
|
239
239
|
end
|
240
240
|
|
241
241
|
processes = []
|
242
|
-
case
|
243
|
-
when
|
242
|
+
case os_name_simple
|
243
|
+
when "solaris"
|
244
244
|
ps_output = `#{ps} -o pid,ppid,nlwp,vsz,rss,pcpu,comm`
|
245
245
|
threads_known = true
|
246
|
-
when
|
246
|
+
when "macosx"
|
247
247
|
ps_output = `#{ps} -w -o pid,ppid,vsz,rss,%cpu,command`
|
248
248
|
threads_known = false
|
249
249
|
else
|