~ubuntu-branches/ubuntu/raring/firebird2.5/raring-proposed

« back to all changes in this revision

Viewing changes to src/utilities/gstat/dba.epp

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2011-09-24 14:12:19 UTC
  • mfrom: (15.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110924141219-pkxk7486f3d8ut9f
Tags: 2.5.1.26349-0~rc1.ds4-5
* Medium urgency for fixing a serious bug in testing

* Import a patch from upstream SVN fixing problems in poll() usage when
  process receives signals like SIGALRM.
  Closes: #642555 -- segfault in the remote interface when using alarm() in
  the client program

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
        Firebird::LongJump::raise();
247
247
}
248
248
 
 
249
namespace
 
250
{
 
251
// all this stuff gets activated ONLY in utility mode
 
252
// therefore we can safely use static variables here
 
253
 
 
254
bool shutdownRequested = false;
 
255
 
 
256
int gstatShutdown(const int reason, const int, void*)
 
257
{
 
258
        if (reason == fb_shutrsn_signal)
 
259
        {
 
260
                shutdownRequested = true;
 
261
                return FB_FAILURE;
 
262
        }
 
263
        return FB_SUCCESS;
 
264
}
 
265
 
 
266
void checkForShutdown(tdba* tddba)
 
267
{
 
268
        if (shutdownRequested)
 
269
        {
 
270
                dba_exit(FINI_OK, tddba);
 
271
        }
 
272
}
 
273
 
 
274
 
 
275
}
 
276
 
249
277
const USHORT GSTAT_MSG_FAC      = 21;
250
278
 
251
279
 
757
785
        ON_ERROR
758
786
                dba_exit(FINI_ERROR, tddba);
759
787
        END_ERROR
 
788
 
 
789
        if (!tddba->uSvc->isService())
 
790
        {
 
791
                // Now it's time to take care ourself about shutdown handling
 
792
                if (fb_shutdown_callback(status_vector, gstatShutdown, fb_shut_confirmation, NULL))
 
793
                {
 
794
                        dba_exit(FINI_ERROR, tddba);
 
795
                }
 
796
        }
 
797
 
760
798
        // FINISH; error!
761
799
        FINISH
762
800
        ON_ERROR
767
805
        {
768
806
                for (const dba_rel* relation = tddba->relations; relation; relation = relation->rel_next)
769
807
                {
 
808
                        checkForShutdown(tddba);
770
809
                        if (relation->rel_id == -1)
771
810
                        {
772
811
                                tddba->uSvc->setServiceStatus(GSTAT_MSG_FAC, 44, SafeArg() << relation->rel_name);
782
821
 
783
822
        for (dba_rel* relation = tddba->relations; relation; relation = relation->rel_next)
784
823
        {
 
824
                checkForShutdown(tddba);
 
825
 
785
826
                // This condition should never happen because relations not found cause an error before.
786
827
                if (relation->rel_id == -1)
787
828
                {
794
835
                }
795
836
                for (dba_idx* index = relation->rel_indexes; index; index = index->idx_next)
796
837
                {
 
838
                        checkForShutdown(tddba);
797
839
                        analyze_index(relation, index);
798
840
                }
799
841
        }