void ispd_die(int status) { BOOL first = FALSE; static int count = 0; static MUTEX mp = MUTEX_INITIALIZER; static char *fid = "ispd_die"; MUTEX_LOCK(&mp); if (++count == 1) { first = TRUE; SEM_INIT(&sp, 0, 1); } else if (status == 0) { util_log(1, "multiple termination signals... force exit"); die(0); } MUTEX_UNLOCK(&mp); if (first) { if (dl != NULL) isidlCloseDiskLoop(dl); set_shutdown(1); if (OutputMediaType() == ISP_OUTPUT_TAPE) { flush_buffer(ISPD_FLUSH_FORCE); SEM_WAIT(&sp); } /* shutdown_inject(); */ die(status); } else { pause(); } }
/* Cleanup loose ends after Modify completes */ static int bdb_cf_cleanup( ConfigArgs *c ) { struct bdb_info *bdb = c->be->be_private; int rc = 0; BerVarray bva; if ( bdb->bi_flags & BDB_DEL_INDEX ) { bdb_attr_flush( bdb ); bdb->bi_flags ^= BDB_DEL_INDEX; } if ( bdb->bi_flags & BDB_RE_OPEN ) { bdb->bi_flags ^= BDB_RE_OPEN; bva = bdb->bi_db_config; bdb->bi_db_config = NULL; rc = c->be->bd_info->bi_db_close( c->be, &c->reply ); if ( rc == 0 ) { if ( bdb->bi_flags & BDB_UPD_CONFIG ) { if ( bva ) { int i; FILE *f = fopen( bdb->bi_db_config_path, "w" ); if ( f ) { bdb->bi_db_config = bva; bva = NULL; for (i=0; bdb->bi_db_config[i].bv_val; i++) fprintf( f, "%s\n", bdb->bi_db_config[i].bv_val ); fclose( f ); } else { ber_bvarray_free( bva ); } } else { unlink( bdb->bi_db_config_path ); } bdb->bi_flags ^= BDB_UPD_CONFIG; } rc = c->be->bd_info->bi_db_open( c->be, &c->reply ); } /* If this fails, we need to restart */ if ( rc ) { set_shutdown( 2 ); snprintf( c->cr_msg, sizeof( c->cr_msg ), "failed to reopen database, rc=%d", rc ); Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(bdb_cf_cleanup) ": %s\n", c->cr_msg ); rc = LDAP_OTHER; } } return rc; }
static void mdm_silent_reset(void) { pr_info("mdm: silent reset!!\n"); set_shutdown(); mdm_drv->mdm_ready = 0; mdm_drv->boot_type = CHARM_NORMAL_BOOT; complete(&mdm_needs_reload); if (!wait_for_completion_timeout(&mdm_boot, msecs_to_jiffies(MDM_BOOT_TIMEOUT))) { mdm_drv->mdm_boot_status = -ETIMEDOUT; pr_info("%s: mdm modem restart timed out.\n", __func__); panic("%s[%p]: Failed to powerup!", __func__, current); } else { pr_info("%s: mdm modem has been restarted\n", __func__); /* Log the reason for the restart */ if (mdm_drv->pdata->sfr_query) queue_work(mdm_sfr_queue, &sfr_reason_work); } INIT_COMPLETION(mdm_boot); }