dovecot-2.0: master: Added default_vsz_limit setting, which defa...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 9 03:49:37 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/a15182f41f30
changeset: 10008:a15182f41f30
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 08 20:49:31 2009 -0400
description:
master: Added default_vsz_limit setting, which defaults to 256 MB.

diffstat:

6 files changed, 13 insertions(+), 4 deletions(-)
doc/example-config/conf.d/master.conf |    1 +
src/master/master-settings.c          |    2 ++
src/master/master-settings.h          |    1 +
src/master/service-process.c          |    8 ++++----
src/master/service.c                  |    3 +++
src/master/service.h                  |    2 ++

diffs (93 lines):

diff -r c862648185b8 -r a15182f41f30 doc/example-config/conf.d/master.conf
--- a/doc/example-config/conf.d/master.conf	Thu Oct 08 20:43:25 2009 -0400
+++ b/doc/example-config/conf.d/master.conf	Thu Oct 08 20:49:31 2009 -0400
@@ -1,5 +1,6 @@ default_process_limit = 100
 default_process_limit = 100
 default_client_limit = 1000
+default_vsz_limit = 256
 
 service config {
   type = config
diff -r c862648185b8 -r a15182f41f30 src/master/master-settings.c
--- a/src/master/master-settings.c	Thu Oct 08 20:43:25 2009 -0400
+++ b/src/master/master-settings.c	Thu Oct 08 20:49:31 2009 -0400
@@ -169,6 +169,7 @@ static struct setting_define master_sett
 	DEF(SET_ENUM, ssl),
 	DEF(SET_UINT, default_process_limit),
 	DEF(SET_UINT, default_client_limit),
+	DEF(SET_UINT, default_vsz_limit),
 
 	DEF(SET_BOOL, version_ignore),
 	DEF(SET_BOOL, mail_debug),
@@ -192,6 +193,7 @@ static struct master_settings master_def
 	MEMBER(ssl) "yes:no:required",
 	MEMBER(default_process_limit) 100,
 	MEMBER(default_client_limit) 1000,
+	MEMBER(default_vsz_limit) 256,
 
 	MEMBER(version_ignore) FALSE,
 	MEMBER(mail_debug) FALSE,
diff -r c862648185b8 -r a15182f41f30 src/master/master-settings.h
--- a/src/master/master-settings.h	Thu Oct 08 20:43:25 2009 -0400
+++ b/src/master/master-settings.h	Thu Oct 08 20:49:31 2009 -0400
@@ -49,6 +49,7 @@ struct master_settings {
 	const char *ssl;
 	unsigned int default_process_limit;
 	unsigned int default_client_limit;
+	unsigned int default_vsz_limit;
 
 	bool version_ignore;
 	bool mail_debug;
diff -r c862648185b8 -r a15182f41f30 src/master/service-process.c
--- a/src/master/service-process.c	Thu Oct 08 20:43:25 2009 -0400
+++ b/src/master/service-process.c	Thu Oct 08 20:49:31 2009 -0400
@@ -345,8 +345,8 @@ drop_privileges(struct service *service,
 	if (auth_args != NULL && service->set->master_set->mail_debug)
 		env_put("DEBUG=1");
 
-	if (service->set->vsz_limit != 0)
-		restrict_process_size(service->set->vsz_limit, -1U);
+	if (service->vsz_limit != 0)
+		restrict_process_size(service->vsz_limit, -1U);
 
 	restrict_access_init(&rset);
 	rset.uid = service->uid;
@@ -658,11 +658,11 @@ get_exit_status_message(struct service *
 	case FATAL_LOGERROR:
 		return "Internal logging error";
 	case FATAL_OUTOFMEM:
-		if (service->set->vsz_limit == 0)
+		if (service->vsz_limit == 0)
 			return "Out of memory";
 		return t_strdup_printf("Out of memory (vsz_limit=%u MB, "
 				       "you may need to increase it)",
-				       service->set->vsz_limit);
+				       service->vsz_limit);
 	case FATAL_EXEC:
 		return "exec() failed";
 
diff -r c862648185b8 -r a15182f41f30 src/master/service.c
--- a/src/master/service.c	Thu Oct 08 20:43:25 2009 -0400
+++ b/src/master/service.c	Thu Oct 08 20:49:31 2009 -0400
@@ -166,6 +166,9 @@ service_create(pool_t pool, const struct
 	if (set->service_count > 0 &&
 	    service->client_limit < set->service_count)
 		service->client_limit = set->service_count;
+
+	service->vsz_limit = set->vsz_limit != 0 ? set->vsz_limit :
+		set->master_set->default_vsz_limit;
 
 	service->type = SERVICE_TYPE_UNKNOWN;
 	if (*set->type != '\0') {
diff -r c862648185b8 -r a15182f41f30 src/master/service.h
--- a/src/master/service.h	Thu Oct 08 20:43:25 2009 -0400
+++ b/src/master/service.h	Thu Oct 08 20:49:31 2009 -0400
@@ -70,6 +70,8 @@ struct service {
 
 	/* Maximum number of client connections a process can handle. */
 	unsigned int client_limit;
+	/* set->vsz_limit or set->master_set->default_client_limit */
+	unsigned int vsz_limit;
 
 	/* log process pipe file descriptors. */
 	int log_fd[2];


More information about the dovecot-cvs mailing list