| 529 | |
| 530 | |
| 531 | void PIO_header(thread_db* tdbb, UCHAR* address, int length) |
| 532 | { |
| 533 | /************************************** |
| 534 | * |
| 535 | * P I O _ h e a d e r |
| 536 | * |
| 537 | ************************************** |
| 538 | * |
| 539 | * Functional description |
| 540 | * Read the page header. |
| 541 | * |
| 542 | **************************************/ |
| 543 | Database* const dbb = tdbb->getDatabase(); |
| 544 | |
| 545 | int i; |
| 546 | SINT64 bytes; |
| 547 | |
| 548 | PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE); |
| 549 | jrd_file* file = pageSpace->file; |
| 550 | |
| 551 | if (file->fil_desc == -1) |
| 552 | unix_error("PIO_header", file, isc_io_read_err); |
| 553 | |
| 554 | for (i = 0; i < IO_RETRY; i++) |
| 555 | { |
| 556 | if ((bytes = os_utils::pread(file->fil_desc, address, length, 0)) == length) |
| 557 | break; |
| 558 | if (bytes < 0 && !SYSCALL_INTERRUPTED(errno)) |
| 559 | unix_error("read", file, isc_io_read_err); |
| 560 | if (bytes >= 0) |
| 561 | block_size_error(file, bytes); |
| 562 | } |
| 563 | |
| 564 | if (i == IO_RETRY) |
| 565 | { |
| 566 | if (bytes == 0) |
| 567 | { |
| 568 | #ifdef DEV_BUILD |
| 569 | fprintf(stderr, "PIO_header: an empty page read!\n"); |
| 570 | fflush(stderr); |
| 571 | #endif |
| 572 | } |
| 573 | else |
| 574 | { |
| 575 | #ifdef DEV_BUILD |
| 576 | fprintf(stderr, "PIO_header: retry count exceeded\n"); |
| 577 | fflush(stderr); |
| 578 | #endif |
| 579 | unix_error("read_retry", file, isc_io_read_err); |
| 580 | } |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | // we need a class here only to return memory on shutdown and avoid |
| 585 | // false memory leak reports |
no test coverage detected