| 885 | |
| 886 | |
| 887 | static int openFile(const PathName& name, const bool forcedWrites, |
| 888 | const bool notUseFSCache, const bool readOnly) |
| 889 | { |
| 890 | /************************************** |
| 891 | * |
| 892 | * o p e n F i l e |
| 893 | * |
| 894 | ************************************** |
| 895 | * |
| 896 | * Functional description |
| 897 | * Open a file with appropriate flags. |
| 898 | * |
| 899 | **************************************/ |
| 900 | |
| 901 | int flag = O_BINARY | (readOnly ? O_RDONLY : O_RDWR); |
| 902 | #ifdef SUPERSERVER_V2 |
| 903 | flag |= SYNC; |
| 904 | // what to do with O_DIRECT here ? |
| 905 | #else |
| 906 | if (forcedWrites) |
| 907 | flag |= SYNC; |
| 908 | if (notUseFSCache) |
| 909 | flag |= O_DIRECT; |
| 910 | #endif |
| 911 | |
| 912 | return os_utils::open(name.c_str(), flag); |
| 913 | } |
| 914 | |
| 915 | |
| 916 | static void maybeCloseFile(int& desc) |
no test coverage detected