MCPcopy Create free account
hub / github.com/apache/arrow / FileIsClosed

Function FileIsClosed

cpp/src/arrow/testing/gtest_util.cc:595–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593#endif
594
595bool FileIsClosed(int fd) {
596#if defined(_WIN32)
597 // Disables default behavior on wrong params which causes the application to crash
598 // https://msdn.microsoft.com/en-us/library/ksazx244.aspx
599 _set_invalid_parameter_handler(InvalidParamHandler);
600
601 // Disables possible assertion alert box on invalid input arguments
602 _CrtSetReportMode(_CRT_ASSERT, 0);
603
604 int new_fd = _dup(fd);
605 if (new_fd == -1) {
606 return errno == EBADF;
607 }
608 _close(new_fd);
609 return false;
610#else
611 if (-1 != fcntl(fd, F_GETFD)) {
612 return false;
613 }
614 return errno == EBADF;
615#endif
616}
617
618#if !defined(_WIN32)
619void AssertChildExit(int child_pid, int expected_exit_status) {

Callers 4

TEST_FFunction · 0.85
TEST_FFunction · 0.85

Calls 1

_closeFunction · 0.85

Tested by

no test coverage detected