| 1957 | } |
| 1958 | |
| 1959 | static bool posix_directory_sync(int dir_fd) { |
| 1960 | if (dir_fd < 0) { |
| 1961 | return false; |
| 1962 | } |
| 1963 | int result; |
| 1964 | do { |
| 1965 | result = fsync(dir_fd); |
| 1966 | } while (result != 0 && errno == EINTR); |
| 1967 | if (result == 0) { |
| 1968 | return true; |
| 1969 | } |
| 1970 | |
| 1971 | int sync_error = errno; |
| 1972 | bool unsupported = sync_error == EINVAL; |
| 1973 | #ifdef ENOTSUP |
| 1974 | unsupported = unsupported || sync_error == ENOTSUP; |
| 1975 | #endif |
| 1976 | #ifdef EOPNOTSUPP |
| 1977 | unsupported = unsupported || sync_error == EOPNOTSUPP; |
| 1978 | #endif |
| 1979 | /* Some POSIX filesystems, including Darwin filesystems, do not expose a |
| 1980 | * directory-sync operation. Record contents are still fsynced before |
| 1981 | * publication, and the recovery state machine accepts either atomic |
| 1982 | * namespace outcome after a crash. */ |
| 1983 | return unsupported; |
| 1984 | } |
| 1985 | |
| 1986 | static bool posix_socket_record_temp_name(const char *record_name, char temp_name[NAME_MAX + 1]) { |
| 1987 | if (!record_name || !temp_name) { |
no outgoing calls
no test coverage detected