Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/coreclr/pal/src/debug/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,15 +742,19 @@ PAL_ProbeMemory(
BOOL fWriteAccess)
{
int fds[2];
int flags;

if (pipe(fds) != 0)
{
ASSERT("pipe failed: errno is %d (%s)\n", errno, strerror(errno));
return FALSE;
}

fcntl(fds[0], O_NONBLOCK);
fcntl(fds[1], O_NONBLOCK);
flags = fcntl(fds[0], F_GETFL, 0);
fcntl(fds[0], F_SETFL, flags | O_NONBLOCK);
Comment on lines +753 to +754
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an alternative would be using pipe2 but this would require an #ifdef

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do some targets not support pipe2?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pipe2 is Linux-specific and we support macOS and few other Unix-like OSese. The current solution is good, I am going to merge the PR.


flags = fcntl(fds[1], F_GETFL, 0);
fcntl(fds[1], F_SETFL, flags | O_NONBLOCK);

PVOID pEnd = (PBYTE)pBuffer + cbBuffer;
BOOL result = TRUE;
Expand Down