diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-09-03 14:44:22 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-09-03 14:44:22 +0000 |
commit | c63de89e7c6ac7a08c2ebe7e2f396f4910a5fb64 (patch) | |
tree | 14dfac66ef7bd987c5974574ada381fb0e892aba | |
parent | 7cdb329d2f6f82cf64b278403a5b86aef2d5d992 (diff) |
Replace [RELAY|SERVER]_MAXPROC with the new PROC_MAX_INSTANCES
variable and limit it from 128 to 32 instances (the old value).
While here, move a few PROC_ defines around.
OK rzalamena@
-rw-r--r-- | usr.sbin/httpd/httpd.h | 11 | ||||
-rw-r--r-- | usr.sbin/httpd/parse.y | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/proc.c | 6 | ||||
-rw-r--r-- | usr.sbin/relayctl/relayctl.c | 8 | ||||
-rw-r--r-- | usr.sbin/relayd/parse.y | 4 | ||||
-rw-r--r-- | usr.sbin/relayd/proc.c | 6 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.h | 13 |
7 files changed, 23 insertions, 29 deletions
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index 290fbf3e1e9..59078a15d1f 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.118 2016/09/02 11:25:14 reyk Exp $ */ +/* $OpenBSD: httpd.h,v 1.119 2016/09/03 14:44:21 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -65,7 +65,6 @@ #define SERVER_TIMEOUT 600 #define SERVER_CACHESIZE -1 /* use default size */ #define SERVER_NUMPROC 3 -#define SERVER_MAXPROC 32 #define SERVER_MAXHEADERLENGTH 8192 #define SERVER_MAXREQUESTS 100 /* max requests per connection */ #define SERVER_MAXREQUESTBODY 1048576 /* 1M */ @@ -86,6 +85,9 @@ #define FCGI_CONTENT_SIZE 65535 +#define PROC_PARENT_SOCK_FILENO 3 +#define PROC_MAX_INSTANCES 32 + enum httpchunk { TOREAD_UNLIMITED = -1, TOREAD_HTTP_HEADER = -2, @@ -227,11 +229,6 @@ enum privsep_procid { /* Attach the control socket to the following process */ #define PROC_CONTROL PROC_LOGGER -/* Define default parent socket number */ -#define PARENT_SOCK_FILENO 3 - -#define PROC_MAX_INSTANCES 128 - struct privsep_pipes { int *pp_pipes[PROC_MAX]; }; diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y index cc72dd83a8a..e836d4c8af4 100644 --- a/usr.sbin/httpd/parse.y +++ b/usr.sbin/httpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.81 2016/08/22 15:02:18 jsing Exp $ */ +/* $OpenBSD: parse.y,v 1.82 2016/09/03 14:44:21 reyk Exp $ */ /* * Copyright (c) 2007 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -193,7 +193,7 @@ opttls : /*empty*/ { $$ = 0; } main : PREFORK NUMBER { if (loadcfg) break; - if ($2 <= 0 || $2 > SERVER_MAXPROC) { + if ($2 <= 0 || $2 > PROC_MAX_INSTANCES) { yyerror("invalid number of preforked " "servers: %lld", $2); YYERROR; diff --git a/usr.sbin/httpd/proc.c b/usr.sbin/httpd/proc.c index a3c3ce549c2..b505d364a8c 100644 --- a/usr.sbin/httpd/proc.c +++ b/usr.sbin/httpd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.25 2016/09/03 10:02:11 reyk Exp $ */ +/* $OpenBSD: proc.c,v 1.26 2016/09/03 14:44:21 reyk Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -131,7 +131,7 @@ proc_exec(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc, break; case 0: /* Prepare parent socket. */ - dup2(fd, PARENT_SOCK_FILENO); + dup2(fd, PROC_PARENT_SOCK_FILENO); execvp(argv[0], nargv); fatal("%s: execvp", __func__); @@ -556,7 +556,7 @@ proc_run(struct privsep *ps, struct privsep_proc *p, signal_add(&ps->ps_evsigusr1, NULL); proc_setup(ps, procs, nproc); - proc_accept(ps, PARENT_SOCK_FILENO, PROC_PARENT, 0); + proc_accept(ps, PROC_PARENT_SOCK_FILENO, PROC_PARENT, 0); if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) { TAILQ_INIT(&ctl_conns); if (control_listen(&ps->ps_csock) == -1) diff --git a/usr.sbin/relayctl/relayctl.c b/usr.sbin/relayctl/relayctl.c index 6545548ddf2..7b52c21e61e 100644 --- a/usr.sbin/relayctl/relayctl.c +++ b/usr.sbin/relayctl/relayctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayctl.c,v 1.56 2015/12/05 13:13:11 claudio Exp $ */ +/* $OpenBSD: relayctl.c,v 1.57 2016/09/03 14:44:21 reyk Exp $ */ /* * Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org> @@ -49,7 +49,7 @@ char *print_rdr_status(int); char *print_host_status(int, int); char *print_table_status(int, int); char *print_relay_status(int); -void print_statistics(struct ctl_stats[RELAY_MAXPROC + 1]); +void print_statistics(struct ctl_stats[PROC_MAX_INSTANCES + 1]); struct imsgname { int type; @@ -330,7 +330,7 @@ show_summary_msg(struct imsg *imsg, int type) struct relay *rlay; struct router *rt; struct netroute *nr; - struct ctl_stats stats[RELAY_MAXPROC]; + struct ctl_stats stats[PROC_MAX_INSTANCES]; char name[HOST_NAME_MAX+1]; switch (imsg->hdr.type) { @@ -536,7 +536,7 @@ print_relay_status(int flags) } void -print_statistics(struct ctl_stats stats[RELAY_MAXPROC + 1]) +print_statistics(struct ctl_stats stats[PROC_MAX_INSTANCES + 1]) { struct ctl_stats crs; int i; diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index e6ea30da60a..0b877207a35 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.210 2016/09/02 16:14:09 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.211 2016/09/03 14:44:21 reyk Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -388,7 +388,7 @@ main : INTERVAL NUMBER { bcopy(&$2, &conf->sc_conf.timeout, sizeof(struct timeval)); } | PREFORK NUMBER { - if ($2 <= 0 || $2 > RELAY_MAXPROC) { + if ($2 <= 0 || $2 > PROC_MAX_INSTANCES) { yyerror("invalid number of preforked " "relays: %d", $2); YYERROR; diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c index 0423a0b2ddd..08dcafa3f1b 100644 --- a/usr.sbin/relayd/proc.c +++ b/usr.sbin/relayd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.31 2016/09/03 14:09:04 reyk Exp $ */ +/* $OpenBSD: proc.c,v 1.32 2016/09/03 14:44:21 reyk Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -131,7 +131,7 @@ proc_exec(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc, break; case 0: /* Prepare parent socket. */ - dup2(fd, PARENT_SOCK_FILENO); + dup2(fd, PROC_PARENT_SOCK_FILENO); execvp(argv[0], nargv); fatal("%s: execvp", __func__); @@ -556,7 +556,7 @@ proc_run(struct privsep *ps, struct privsep_proc *p, signal_add(&ps->ps_evsigusr1, NULL); proc_setup(ps, procs, nproc); - proc_accept(ps, PARENT_SOCK_FILENO, PROC_PARENT, 0); + proc_accept(ps, PROC_PARENT_SOCK_FILENO, PROC_PARENT, 0); if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) { TAILQ_INIT(&ctl_conns); if (control_listen(&ps->ps_csock) == -1) diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index eb460bf9d78..78a1f2c5789 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.232 2016/09/03 14:09:04 reyk Exp $ */ +/* $OpenBSD: relayd.h,v 1.233 2016/09/03 14:44:21 reyk Exp $ */ /* * Copyright (c) 2006 - 2016 Reyk Floeter <reyk@openbsd.org> @@ -69,7 +69,6 @@ #define RELAY_TIMEOUT 600 #define RELAY_CACHESIZE -1 /* use default size */ #define RELAY_NUMPROC 3 -#define RELAY_MAXPROC 32 #define RELAY_MAXHOSTS 32 #define RELAY_MAXHEADERLENGTH 8192 #define RELAY_STATINTERVAL 60 @@ -95,6 +94,9 @@ #define SNMP_RECONNECT_TIMEOUT { 3, 0 } /* sec, usec */ +#define PROC_PARENT_SOCK_FILENO 3 +#define PROC_MAX_INSTANCES 32 + #if DEBUG > 1 #define DPRINTF log_debug #define DEBUG_CERT 1 @@ -805,7 +807,7 @@ struct relay { char *rl_tls_cakey; EVP_PKEY *rl_tls_capkey; - struct ctl_stats rl_stats[RELAY_MAXPROC + 1]; + struct ctl_stats rl_stats[PROC_MAX_INSTANCES + 1]; struct session_tree rl_sessions; }; @@ -988,11 +990,6 @@ enum privsep_procid { /* Attach the control socket to the following process */ #define PROC_CONTROL PROC_PFE -/* Define default parent socket number */ -#define PARENT_SOCK_FILENO 3 - -#define PROC_MAX_INSTANCES 128 - struct privsep_pipes { int *pp_pipes[PROC_MAX]; }; |