diff --git a/master.c b/master.c index ad5bf4e9..2a260207 100644 --- a/master.c +++ b/master.c @@ -10,12 +10,13 @@ void get_linux_tcp_info(int fd) { if (!getsockopt(fd, IPPROTO_TCP, TCP_INFO, &ti, &tis)) { // a check for older linux kernels if (!ti.tcpi_sacked) { - return 0; + return; } if (ti.tcpi_unacked >= ti.tcpi_sacked) { uwsgi_log_verbose("*** uWSGI listen queue of socket %d full !!! (%d/%d) ***\n", fd, ti.tcpi_unacked, ti.tcpi_sacked); } } + } #endif diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 1ca3141f..f6bf7aee 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -630,6 +630,7 @@ struct uwsgi_plugin python_plugin = { .post_fork = uwsgi_python_post_fork, .options = uwsgi_python_options, .manage_opt = uwsgi_python_manage_options, + .short_options = "w:O:H:j:", .request = uwsgi_request_wsgi, .after_request = uwsgi_after_request_wsgi, .init_apps = uwsgi_python_init_app, diff --git a/uwsgi.c b/uwsgi.c index 6fe595ef..13762506 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -27,7 +27,10 @@ struct uwsgi_server uwsgi; extern char **environ; -static struct option *long_options; +static struct option *long_options = NULL; +static char *short_options = NULL; + +static char *base_short_options = "s:p:t:x:d:l:v:b:mcaCTiMhrR:z:A:Q:L"; static struct option long_base_options[] = { {"socket", required_argument, 0, 's'}, @@ -462,7 +465,7 @@ int main(int argc, char *argv[], char *envp[]) { build_options(); - while ((i = getopt_long(argc, argv, "s:p:t:x:d:l:O:v:b:mcaCTiMhrR:z:w:j:H:A:Q:L", long_options, &option_index)) != -1) { + while ((i = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) { manage_opt(i, optarg); } @@ -2075,6 +2078,35 @@ void build_options() { int i; struct option *lopt, *aopt; int opt_count = count_options(long_base_options); + int short_opt_size = strlen(base_short_options); + char *so_ptr; + + for(i=0;i<0xFF;i++) { + if (uwsgi.shared->hook_short_options[i]) { + short_opt_size += strlen(uwsgi.shared->hook_short_options[i]); + } + } + + if (short_options) { + free(short_options); + } + + short_options = malloc(short_opt_size+1); + if (!short_options) { + uwsgi_error("malloc()"); + exit(1); + } + memcpy(short_options, base_short_options, strlen(base_short_options)); + so_ptr = short_options+strlen(base_short_options) ; + + for(i=0;i<0xFF;i++) { + if (uwsgi.shared->hook_short_options[i]) { + memcpy(so_ptr, uwsgi.shared->hook_short_options[i], strlen(uwsgi.shared->hook_short_options[i])); + so_ptr+=strlen(uwsgi.shared->hook_short_options[i]) ; + } + } + + *so_ptr = 0; for(i=0;i<0xFF;i++) { if (uwsgi.shared->hook_options[i]) { diff --git a/uwsgi.h b/uwsgi.h index 755a9fe0..ceeb4e67 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -20,6 +20,7 @@ uwsgi.shared->hook_post_fork[x] = up->post_fork;\ uwsgi.shared->hook_options[x] = up->options;\ uwsgi.shared->hook_manage_opt[x] = up->manage_opt;\ + uwsgi.shared->hook_short_options[x] = up->short_options;\ uwsgi.shared->hook_request[x] = up->request;\ uwsgi.shared->hook_after_request[x] = up->after_request;\ uwsgi.shared->hook_init_apps[x] = up->init_apps;\ @@ -43,6 +44,8 @@ #include #include #include +#include + #include @@ -779,6 +782,7 @@ struct uwsgi_shared { void (*hook_init_thread[0xFF]) (void); void (*hook_init_apps[0xFF]) (void); struct option *hook_options[0xFF]; + const char *hook_short_options[0xFF]; int (*hook_manage_opt[0xFF]) (int, char*); int (*hook_manage_udp[0xFF]) (char *, int, char*, int); int (*hook_manage_xml[0xFF]) (char *, char *); @@ -1083,6 +1087,7 @@ struct uwsgi_plugin { int (*init)(void); void (*post_fork)(void); struct option *options; + const char *short_options; int (*manage_opt)(int, char*); void (*magic)(char *); void (*enable_threads)(void);