[dovecot-cvs] dovecot/src/lib alarm-hup.c,1.4,1.5

cras at procontrol.fi cras at procontrol.fi
Mon Feb 3 07:01:08 EET 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv16952/lib

Modified Files:
	alarm-hup.c 
Log Message:
We don't need to raise SIGHUP in alarm handler, that was just a mistake in
first tests. That also means gdb won't break at SIGALRM and I can remove the
DISABLE_ALARMHUP kludge.



Index: alarm-hup.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/alarm-hup.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- alarm-hup.c	26 Jan 2003 22:50:40 -0000	1.4
+++ alarm-hup.c	3 Feb 2003 05:01:05 -0000	1.5
@@ -37,9 +37,6 @@
 {
 	unsigned int old;
 
-	if (getenv("DISABLE_ALARMHUP") != NULL)
-		return 0;
-
 	old = alarm_timeout;
 	alarm_timeout = timeout;
 
@@ -49,32 +46,18 @@
 
 static void sig_alarm(int signo __attr_unused__)
 {
-	/* we need syscalls to stop with EINTR */
-	if (raise(SIGHUP) < 0)
-		i_fatal("kill(): %m");
-
 	/* do it again */
 	alarm(alarm_timeout);
-
-#ifndef HAVE_SIGACTION
-	signal(SIGALRM, sig_alarm);
-#endif
 }
 
 void alarm_hup_init(void)
 {
-#ifdef HAVE_SIGACTION
 	struct sigaction act;
-#endif
-
-	if (getenv("DISABLE_ALARMHUP") != NULL)
-		alarm_timeout = 0;
 
 	if (initialized)
 		return;
 	initialized = TRUE;
 
-#ifdef HAVE_SIGACTION
 	if (sigemptyset(&act.sa_mask) < 0)
 		i_fatal("sigemptyset(): %m");
 	act.sa_flags = 0;
@@ -84,23 +67,13 @@
 		if (errno != EINTR)
 			i_fatal("sigaction(): %m");
 	}
-#else
-	/* at least Linux blocks raise(SIGHUP) inside SIGALRM
-	   handler if it's added with signal().. sigaction() should
-	   be pretty much everywhere though, so this code is pretty
-	   useless. */
-#warning timeouting may not work
-	signal(SIGALRM, sig_alarm);
-#endif
 
 	alarm(alarm_timeout);
 }
 
 void alarm_hup_deinit(void)
 {
-#ifdef HAVE_SIGACTION
 	struct sigaction act;
-#endif
 
 	if (!initialized)
 		return;
@@ -108,7 +81,6 @@
 
 	alarm(0);
 
-#ifdef HAVE_SIGACTION
 	if (sigemptyset(&act.sa_mask) < 0)
 		i_fatal("sigemptyset(): %m");
 	act.sa_flags = 0;
@@ -117,7 +89,4 @@
 		if (errno != EINTR)
 			i_fatal("sigaction(): %m");
 	}
-#else
-	signal(SIGALRM, SIG_DFL);
-#endif
 }




More information about the dovecot-cvs mailing list