| 720 | -------------------------------------------------------------------------*/ |
| 721 | |
| 722 | void |
| 723 | LogFile::check_fd() |
| 724 | { |
| 725 | static bool failure_last_call = false; |
| 726 | static unsigned stat_check_count = 1; |
| 727 | |
| 728 | if ((stat_check_count % Log::config->file_stat_frequency) == 0) { |
| 729 | // |
| 730 | // It's time to see if the file really exists. If we can't see |
| 731 | // the file (via access), then we'll close our descriptor and |
| 732 | // attempt to re-open it, which will create the file if it's not |
| 733 | // there. |
| 734 | // |
| 735 | if (m_name && !LogFile::exists(m_name)) { |
| 736 | close_file(); |
| 737 | } |
| 738 | stat_check_count = 0; |
| 739 | } |
| 740 | stat_check_count++; |
| 741 | |
| 742 | int err = open_file(); |
| 743 | // XXX if open_file() returns, LOG_FILE_FILESYSTEM_CHECKS_FAILED, raise a more informative alarm ... |
| 744 | if (err != LOG_FILE_NO_ERROR && err != LOG_FILE_NO_PIPE_READERS) { |
| 745 | if (!failure_last_call) { |
| 746 | Warning("Traffic Server could not open logfile %s: %s.", m_name, strerror(errno)); |
| 747 | } |
| 748 | failure_last_call = true; |
| 749 | return; |
| 750 | } |
| 751 | |
| 752 | failure_last_call = false; |
| 753 | } |
| 754 | |
| 755 | void |
| 756 | LogFile::display(FILE *fd) |
no test coverage detected