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

Function FileIsClosed

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

Source from the content-addressed store, hash-verified

601#endif
602
603bool FileIsClosed(int fd) {
604#if defined(_WIN32)
605 // Disables default behavior on wrong params which causes the application to crash
606 // https://msdn.microsoft.com/en-us/library/ksazx244.aspx
607 _set_invalid_parameter_handler(InvalidParamHandler);
608
609 // Disables possible assertion alert box on invalid input arguments
610 _CrtSetReportMode(_CRT_ASSERT, 0);
611
612 int new_fd = _dup(fd);
613 if (new_fd == -1) {
614 return errno == EBADF;
615 }
616 _close(new_fd);
617 return false;
618#else
619 if (-1 != fcntl(fd, F_GETFD)) {
620 return false;
621 }
622 return errno == EBADF;
623#endif
624}
625
626#if !defined(_WIN32)
627void 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