[at] at-3.1.13-usePOSIXtimers.patch use POSIX timers, so we won't need pm-utils hack anymore.

Marcela Mašláňová mmaslano at fedoraproject.org
Thu Apr 19 15:41:43 UTC 2012


commit 197130ca9ae9117ab653580d2169f5b38c03e534
Author: Marcela Mašláňová <mmaslano at redhat.com>
Date:   Tue Apr 17 14:28:52 2012 +0200

    at-3.1.13-usePOSIXtimers.patch use POSIX timers, so we won't need
    pm-utils hack anymore.

 at-3.1.13-usePOSIXtimers.patch |  119 ++++++++++++++++++++++++++++++++++++++++
 at.spec                        |    9 +--
 2 files changed, 123 insertions(+), 5 deletions(-)
---
diff --git a/at-3.1.13-usePOSIXtimers.patch b/at-3.1.13-usePOSIXtimers.patch
new file mode 100644
index 0000000..b1afeb6
--- /dev/null
+++ b/at-3.1.13-usePOSIXtimers.patch
@@ -0,0 +1,119 @@
+diff -ur -x configure at-3.1.13.orig/atd.c at-3.1.13/atd.c
+--- at-3.1.13.orig/atd.c	2011-11-16 11:30:22.424764253 -0500
++++ at-3.1.13/atd.c	2011-11-16 16:41:12.102831656 -0500
+@@ -815,6 +815,54 @@
+     return next_job;
+ }
+ 
++#ifdef HAVE_CLOCK_GETTIME
++timer_t timer;
++struct itimerspec timeout;
++
++void timer_setup()
++{
++    struct sigevent sev;
++
++    sev.sigev_notify = SIGEV_SIGNAL;
++    sev.sigev_signo = SIGHUP;
++    sev.sigev_value.sival_ptr = &timer;
++
++    memset(&timeout, 0, sizeof(timeout));
++
++    if (timer_create(CLOCK_REALTIME, &sev, &timer) < 0)
++	    pabort("unable to create timer");
++}
++
++time_t atd_gettime()
++{
++    struct timespec curtime;
++
++    clock_gettime(CLOCK_REALTIME, &curtime);
++
++    return curtime.tv_sec;
++}
++
++void atd_setalarm(time_t next)
++{
++    timeout.it_value.tv_sec = next;
++    timer_settime(timer, TIMER_ABSTIME, &timeout, NULL);
++    pause();
++}
++#else
++void timer_setup()
++{
++}
++
++time_t atd_gettime()
++{
++    return time(NULL);
++}
++
++void atd_setalarm(time_t next)
++{
++    sleep(next - atd_gettime());
++}
++#endif
+ /* Global functions */
+ 
+ int
+@@ -835,7 +883,6 @@
+     struct sigaction act;
+     struct passwd *pwe;
+     struct group *ge;
+-
+ #ifdef WITH_SELINUX
+     selinux_enabled=is_selinux_enabled();
+ #endif
+@@ -912,7 +959,7 @@
+     sigaction(SIGCHLD, &act, NULL);
+ 
+     if (!run_as_daemon) {
+-	now = time(NULL);
++	now = atd_gettime();
+ 	run_loop();
+ 	exit(EXIT_SUCCESS);
+     }
+@@ -935,13 +982,15 @@
+     act.sa_handler = set_term;
+     sigaction(SIGINT, &act, NULL);
+ 
++    timer_setup();
++
+     daemon_setup();
+ 
+     do {
+-	now = time(NULL);
++	now = atd_gettime();
+ 	next_invocation = run_loop();
+ 	if (next_invocation > now) {
+-	    sleep(next_invocation - now);
++	    atd_setalarm(next_invocation);
+ 	}
+     } while (!term_signal);
+     daemon_cleanup();
+diff -ur -x configure at-3.1.13.orig/config.h.in at-3.1.13/config.h.in
+--- at-3.1.13.orig/config.h.in	2011-11-16 11:30:22.424764253 -0500
++++ at-3.1.13/config.h.in	2011-11-16 16:32:44.485426754 -0500
+@@ -38,6 +38,9 @@
+ /* Define to 1 if you have the `getloadavg' function. */
+ #undef HAVE_GETLOADAVG
+ 
++/* Define to 1 if you have the `clock_gettime' function. */
++#undef HAVE_CLOCK_GETTIME
++
+ /* Define to 1 if you have the <getopt.h> header file. */
+ #undef HAVE_GETOPT_H
+ 
+diff -ur -x configure at-3.1.13.orig/configure.ac at-3.1.13/configure.ac
+--- at-3.1.13.orig/configure.ac	2011-11-16 11:30:22.425764254 -0500
++++ at-3.1.13/configure.ac	2011-11-16 16:31:29.791561747 -0500
+@@ -274,5 +274,9 @@
+ AC_SUBST(SELINUXLIB)
+ AC_SUBST(WITH_SELINUX)
+ 
++dnl check for POSIX timer functions
++AC_SEARCH_LIBS([clock_gettime],[rt])
++AC_CHECK_FUNCS([clock_gettime])
++
+ AC_CONFIG_FILES(Makefile atrun atd.8 atrun.8 at.1 at.allow.5 batch)
+ AC_OUTPUT
diff --git a/at.spec b/at.spec
index 6c18016..5b7db97 100644
--- a/at.spec
+++ b/at.spec
@@ -12,7 +12,6 @@ Source:		http://ftp.debian.org/debian/pool/main/a/at/at_%{version}.orig.tar.gz
 Source1:	pam_atd
 Source2:	atd.init
 Source3:	atd.sysconf
-Source4:	56atd
 Source5:	atd.systemd
 
 Patch1:		at-3.1.13-makefile.patch
@@ -24,6 +23,7 @@ Patch6:		at-3.1.13-selinux.patch
 Patch7:		at-3.1.12-nowrap.patch
 Patch8:		at-3.1.12-fix_no_export.patch 
 Patch9:         at-3.1.13-mailwithhostname.patch
+Patch10:        at-3.1.13-usePOSIXtimers.patch
 
 BuildRequires: fileutils /etc/init.d
 BuildRequires: flex flex-static bison autoconf
@@ -75,6 +75,7 @@ cp %{SOURCE1} .
 %patch7 -p1 -b .nowrap
 %patch8 -p1 -b .export
 %patch9 -p1 -b .mail
+%patch10 -p1 -b .posix
 
 %build
 # patch9 touches configure.in
@@ -122,9 +123,6 @@ install -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/atd
 mkdir -p %{buildroot}/etc/sysconfig
 install -m 644 %{SOURCE3} %{buildroot}/etc/sysconfig/atd
 
-mkdir -p %{buildroot}/%{_libdir}/pm-utils/sleep.d/
-install -m 755 %{SOURCE4} %{buildroot}/%{_libdir}/pm-utils/sleep.d/56atd
-
 # install systemd initscript
 mkdir -p %{buildroot}/%{_unitdir}/
 install -m 644 %{SOURCE5} %{buildroot}/%{_unitdir}/atd.service
@@ -183,7 +181,6 @@ fi
 %{_bindir}/atrm
 %{_bindir}/atq
 %attr(4755,root,root)		%{_bindir}/at
-%attr(0755,root,root)		%{_libdir}/pm-utils/sleep.d/56atd
 %attr(0644,root,root)		/%{_unitdir}/atd.service
 
 %files sysvinit
@@ -192,6 +189,8 @@ fi
 %changelog
 * Tue Apr 17 2012 Marcela Mašláňová <mmaslano at redhat.com> - 3.1.13-7
 - at-3.1.13-mailwithhostname.patch in email mention also hostname address
+- at-3.1.13-usePOSIXtimers.patch use POSIX timers, so we won't need
+  pm-utils hack anymore
 
 * Thu Jan 12 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.1.13-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild


More information about the scm-commits mailing list