mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 13:41:28 +00:00
Merge pull request #56 from xtfxme/feature/extract
feature/extract: dump the specified address to stdout and exit
This commit is contained in:
+17
-1
@@ -105,7 +105,8 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
{"suspend", required_argument, 0, "suspend an instance", uwsgi_opt_pidfile_signal, (void *) SIGTSTP, UWSGI_OPT_IMMEDIATE},
|
||||
{"resume", required_argument, 0, "resume an instance", uwsgi_opt_pidfile_signal, (void *) SIGTSTP, UWSGI_OPT_IMMEDIATE},
|
||||
|
||||
{"connect-and-read", required_argument, 0, "connect to a scoekt and wait for data from it", uwsgi_opt_connect_and_read, NULL, UWSGI_OPT_IMMEDIATE},
|
||||
{"connect-and-read", required_argument, 0, "connect to a socket and wait for data from it", uwsgi_opt_connect_and_read, NULL, UWSGI_OPT_IMMEDIATE},
|
||||
{"extract", required_argument, 0, "fetch/dump any supported address to stdout", uwsgi_opt_extract, NULL, UWSGI_OPT_IMMEDIATE},
|
||||
|
||||
{"listen", required_argument, 'l', "set the socket listen queue size", uwsgi_opt_set_int, &uwsgi.listen_queue, 0},
|
||||
{"max-vars", required_argument, 'v', "set the amount of internal iovec/vars structures", uwsgi_opt_max_vars, NULL, 0},
|
||||
@@ -3880,3 +3881,18 @@ void uwsgi_opt_connect_and_read(char *opt, char *address, void *foobar) {
|
||||
uwsgi_log("%.*s", (int) len, buf);
|
||||
}
|
||||
}
|
||||
|
||||
void uwsgi_opt_extract(char *opt, char *address, void *foobar) {
|
||||
|
||||
int len = 0;
|
||||
char *buf;
|
||||
|
||||
buf = uwsgi_open_and_read(address, &len, 0, NULL);
|
||||
if (len > 0) {
|
||||
if (write(1, buf, len) != len) {
|
||||
uwsgi_error("write()");
|
||||
exit(1);
|
||||
};
|
||||
};
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -3216,6 +3216,7 @@ void manage_cluster_message(char *, int);
|
||||
void uwsgi_opt_add_custom_option(char *, char *, void *);
|
||||
void uwsgi_opt_cflags(char *, char *, void *);
|
||||
void uwsgi_opt_connect_and_read(char *, char *, void *);
|
||||
void uwsgi_opt_extract(char *, char *, void *);
|
||||
|
||||
struct uwsgi_string_list *uwsgi_string_list_has_item(struct uwsgi_string_list *, char *, size_t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user