changeset 10140:0893112306d1 HEAD

ssl-params: When generating parameters, run the process with priority +15.
author Timo Sirainen <tss@iki.fi>
date Thu, 22 Oct 2009 19:12:27 -0400
parents 38c307c7af2a
children 7ddd6d3315a0
files src/ssl-params/ssl-params.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ssl-params/ssl-params.c	Thu Oct 22 19:11:14 2009 -0400
+++ b/src/ssl-params/ssl-params.c	Thu Oct 22 19:12:27 2009 -0400
@@ -11,12 +11,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
+#ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#  include <sys/resource.h>
+#endif
 
 #define MAX_PARAM_FILE_SIZE 1024
 #define SSL_BUILD_PARAM_TIMEOUT_SECS (60*30)
+#define SSL_PARAMS_PRIORITY 15
 
 struct ssl_params {
 	char *path;
@@ -35,6 +41,11 @@
 	mode_t old_mask;
 	int fd, ret;
 
+#ifdef HAVE_SETPRIORITY
+	if (setpriority(PRIO_PROCESS, 0, SSL_PARAMS_PRIORITY) < 0)
+		i_error("setpriority(%d) failed: %m", SSL_PARAMS_PRIORITY);
+#endif
+
 	temp_path = t_strconcat(path, ".tmp", NULL);
 
 	old_mask = umask(0);