RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 23-Jul-2007 00:10:27
Branch: HEAD Handle: 2007072223102601
Modified files:
rpm CHANGES
rpm/python rpmmodule.c
rpm/rpmdb rpmdb.c rpmdb.h
Log:
- adjust signal polling for python exit purposes <pmatlai@redhat.com>.
Summary:
Revision Changes Path
1.1512 +2 -2 rpm/CHANGES
1.152 +0 -2 rpm/python/rpmmodule.c
1.139 +12 -8 rpm/rpmdb/rpmdb.c
1.62 +7 -2 rpm/rpmdb/rpmdb.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1511 -r1.1512 CHANGES
--- rpm/CHANGES 22 Jul 2007 11:06:46 -0000 1.1511
+++ rpm/CHANGES 22 Jul 2007 22:10:26 -0000 1.1512
@@ -1,6 +1,6 @@
4.5 -> 5.0:
+ - jbj: adjust signal polling for python exit purposes <pmatlai@redhat.com>.
- rse: provide a first cut for an librpmconstant.vers ld(1) version script
- - jbj: (re-)add %{?dir/file} as shorthand for %{?dir:%{dir}/file}.
- jbj: reapply 2.127 with more careful rpmExpand() fix.
- jbj: scale _macro_BUFSIZE as 2 * BUFSIZ (16384) everywhere but rpmExpand()
- jbj: use _macro_BUFSIZ, not compiled in BUFSIZ, to size expansion targets.
@@ -9,7 +9,7 @@
- jbj: rescuscitate rpm-perl, include <rpmio.h> explicitly.
- jbj: perl.prov fiddles (#249135).
- jbj: rescuscitate rpm-python, include <rpmio.h> explicitly.
- - jbj: adopt rpm.org signal handling <pmatlai@redhat.com>
+ - jbj: adopt rpm.org signal handling <pmatlai@redhat.com>.
- jbj: fix a --import memory leak.
- rse: unbreak big-endian handling in memory and cryptography functions by Autoconf providing WORDS_BIGENDIAN and fixing usage
- rse: cleanup and fix the code to compile under *non*-GCC compilers (e.g. Sun Studio and Intel C/C++)
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/rpmmodule.c
============================================================================
$ cvs diff -u -r1.151 -r1.152 rpmmodule.c
--- rpm/python/rpmmodule.c 20 Jul 2007 22:47:34 -0000 1.151
+++ rpm/python/rpmmodule.c 22 Jul 2007 22:10:26 -0000 1.152
@@ -212,8 +212,6 @@
/*
* Force clean up of open iterators and dbs on exit.
- * This ends up calling exit() while we're already exiting but exit
- * handlers will only get called once so it wont loop.
*/
static void rpm_exithook(void)
{
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmdb.c
============================================================================
$ cvs diff -u -r1.138 -r1.139 rpmdb.c
--- rpm/rpmdb/rpmdb.c 22 Jul 2007 01:10:05 -0000 1.138
+++ rpm/rpmdb/rpmdb.c 22 Jul 2007 22:10:27 -0000 1.139
@@ -690,7 +690,7 @@
sigset_t newMask, oldMask;
static int terminating = 0;
- if (terminating) return 0;
+ if (terminating) return 1;
(void) sigfillset(&newMask); /* block all signals */
(void) sigprocmask(SIG_BLOCK, &newMask, &oldMask);
@@ -707,10 +707,6 @@
rpmdb db;
rpmdbMatchIterator mi;
-/*@-abstract@*/ /* sigset_t is abstract type */
- rpmMessage(RPMMESS_DEBUG, "Exiting on signal(0x%lx) ...\n", *((unsigned long *)&rpmsqCaught));
-/*@=abstract@*/
-
/*@-branchstate@*/
while ((mi = rpmmiRock) != NULL) {
/*@i@*/ rpmmiRock = mi->mi_next;
@@ -726,14 +722,22 @@
(void) rpmdbClose(db);
}
/*@=newreftrans@*/
- exit(EXIT_FAILURE);
}
- return sigprocmask(SIG_SETMASK, &oldMask, NULL);
+
+ (void) sigprocmask(SIG_SETMASK, &oldMask, NULL);
+ return terminating;
}
int rpmdbCheckSignals(void)
{
- return rpmdbCheckTerminate(0);
+
+ if (rpmdbCheckTerminate(0)) {
+/*@-abstract@*/ /* sigset_t is abstract type */
+ rpmMessage(RPMMESS_DEBUG, "Exiting on signal(0x%lx) ...\n", *((unsigned long *)&rpmsqCaught));
+/*@=abstract@*/
+ exit(EXIT_FAILURE);
+ }
+ return 0;
}
/**
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmdb.h
============================================================================
$ cvs diff -u -r1.61 -r1.62 rpmdb.h
--- rpm/rpmdb/rpmdb.h 20 Jul 2007 22:47:35 -0000 1.61
+++ rpm/rpmdb/rpmdb.h 22 Jul 2007 22:10:27 -0000 1.62
@@ -1136,8 +1136,13 @@
/*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmdb
- * Check rpmdb signal handler for trapped signal, or requested exit.
+ * Check rpmdb signal handler for trapped signal and/or requested exit.
+ * Clean up any open iterators and databases on termination condition.
+ * On non-zero exit any open references to rpmdb are invalid and cannot
+ * be accessed anymore, calling process should terminate immediately.
+ *
* @param terminate 0 to only check for signals, 1 to terminate anyway
+ * @return 0 to continue, 1 if termination cleanup was done.
*/
/*@mayexit@*/
int rpmdbCheckTerminate(int terminate)
@@ -1145,7 +1150,7 @@
/*@modifies fileSystem, internalState @*/;
/** \ingroup rpmdb
- * Check rpmdb signal handler for trapped signal and exit.
+ * Check for and exit on termination signals.
*/
/*@mayexit@*/
int rpmdbCheckSignals(void)
@@ .
Received on Mon Jul 23 00:10:27 2007