void db_row_set_w::setup_child_phase_2() { if ((num_rows() > 0) & (num_cols() > 0)) { // Resize the list of column locks, with default state unlocked. col_locks.resize(num_cols(), DB_UNLOCKED); // Collect information about database tables, columns and primary keys. init_db_info(); // If a table has no primary key, then make that table and all of its // columns non-writeable. row_set_is_writable = false; for (unsigned int i = 0; i < my_tables.size(); i++) { if (my_tables[i].keys.size() == 0) { my_tables[i].is_writable = false; for (unsigned int j = 0; j < my_tables[i].cols.size(); j++) col_locks[my_tables[i].cols[j]] = DB_LOCKED_PERM; } else { my_tables[i].is_writable = true; row_set_is_writable = true; } } } }
int main(void) { int ret; char *path = "/DSC/OLD"; char *path2 = "/DSC"; int pid = -1; int cnt = 0; ret = init_db_info(); signal(SIGCHLD, handleChildProcess); if( ret == 0 ) { print_db_info(); if ((pid = fork()) < 0){ printf ("fork() fail....\n"); return -1; } if ( pid == 0) { ret = db_backup(path); if( ret == 0 ) { printf("success db backup...\n"); } exit(0); } } if ((pid = fork()) < 0){ printf ("fork() fail....\n"); return -1; } if ( pid == 0) { ret = db_backup(path2); if( ret == 0 ) { printf("success db backup...\n"); } exit(0); } while(1) { if( (cnt % 500000) == 0 ) printf("mother is alive.\n"); if( cnt > 1000000 ) { break; } cnt++; } return 0; }