Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2017-12-05 05:32:59 +0300
committerGitHub <noreply@github.com>2017-12-05 05:32:59 +0300
commit9a563e12649a5f407d57605dc07a82637a22ef48 (patch)
tree5eaca34b6640365e0ebf8ca1fd6cc8bb0c113dc3 /src/Native
parent507163638f38278de67aa409c9228583035e9b49 (diff)
Fix pal_networking.c compilation error on some platforms (#25687)
Diffstat (limited to 'src/Native')
-rw-r--r--src/Native/Unix/System.Native/pal_networking.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/Native/Unix/System.Native/pal_networking.c b/src/Native/Unix/System.Native/pal_networking.c
index 545fe9e025..9815f82e3e 100644
--- a/src/Native/Unix/System.Native/pal_networking.c
+++ b/src/Native/Unix/System.Native/pal_networking.c
@@ -2272,35 +2272,48 @@ int32_t SystemNative_Socket(int32_t addressFamily, int32_t socketType, int32_t p
return *createdSocket != -1 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno);
}
-int32_t GetInt32Ioctl(intptr_t socket, unsigned long request, int32_t* available)
+int32_t SystemNative_GetAtOutOfBandMark(intptr_t socket, int32_t* atMark)
{
- if (available == NULL)
+ if (atMark == NULL)
{
return Error_EFAULT;
}
int fd = ToFileDescriptor(socket);
- int avail;
+ int result;
int err;
- while ((err = ioctl(fd, request, &avail)) < 0 && errno == EINTR);
+ while ((err = ioctl(fd, SIOCATMARK, &result)) < 0 && errno == EINTR);
if (err == -1)
{
+ *atMark = 0;
return SystemNative_ConvertErrorPlatformToPal(errno);
}
- *available = (int32_t)avail;
+ *atMark = (int32_t)result;
return Error_SUCCESS;
}
-int32_t SystemNative_GetAtOutOfBandMark(intptr_t socket, int32_t* available)
-{
- return GetInt32Ioctl(socket, SIOCATMARK, available);
-}
-
int32_t SystemNative_GetBytesAvailable(intptr_t socket, int32_t* available)
{
- return GetInt32Ioctl(socket, FIONREAD, available);
+ if (available == NULL)
+ {
+ return Error_EFAULT;
+ }
+
+ int fd = ToFileDescriptor(socket);
+
+ int result;
+ int err;
+ while ((err = ioctl(fd, FIONREAD, &result)) < 0 && errno == EINTR);
+ if (err == -1)
+ {
+ *available = 0;
+ return SystemNative_ConvertErrorPlatformToPal(errno);
+ }
+
+ *available = (int32_t)result;
+ return Error_SUCCESS;
}
#if HAVE_EPOLL