dovecot-2.0-sslstream: mail storage service: Returning "nice" fr...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:55:25 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/8e3fd502d54e
changeset: 10139:8e3fd502d54e
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 22 19:10:48 2009 -0400
description:
mail storage service: Returning "nice" from userdb again changes process priority.

diffstat:

1 file changed, 16 insertions(+)
src/lib-storage/mail-storage-service.c |   16 ++++++++++++++++

diffs (33 lines):

diff -r dfbbbde95e5f -r 8e3fd502d54e src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Thu Oct 22 19:06:50 2009 -0400
+++ b/src/lib-storage/mail-storage-service.c	Thu Oct 22 19:10:48 2009 -0400
@@ -23,6 +23,13 @@
 #include <pwd.h>
 #include <grp.h>
 
+#ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#  include <sys/resource.h>
+#endif
+
 /* If time moves backwards more than this, kill ourself instead of sleeping. */
 #define MAX_TIME_BACKWARDS_SLEEP 5
 #define MAX_NOWARN_FORWARD_SECS 10
@@ -123,6 +130,15 @@ user_reply_handle(struct mail_storage_se
 		if (strncmp(line, "system_groups_user=", 19) == 0) {
 			user->system_groups_user =
 				p_strdup(user->pool, line + 19);
+		} else if (strncmp(line, "nice=", 5) == 0) {
+#ifdef HAVE_SETPRIORITY
+			int n = atoi(line + 5);
+
+			if (n != 0) {
+				if (setpriority(PRIO_PROCESS, 0, n) < 0)
+					i_error("setpriority(%d) failed: %m", n);
+			}
+#endif
 		} else T_BEGIN {
 			if (strncmp(line, "mail=", 5) == 0) {
 				line = t_strconcat("mail_location=",


More information about the dovecot-cvs mailing list