[mini] Always emit safepoints, except WASM
[mono-project.git] / mono / metadata / pal-android.c
bloba30fcada9f7313f79133d7e744341d42a1d00e90
1 /**
2 * \file
3 * System.Native PAL internal calls (Android)
4 * Adapter code between the Mono runtime and the CoreFX Platform Abstraction Layer (PAL)
5 * Copyright 2018 Microsoft
6 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
7 */
9 #include <unistd.h>
10 #include <assert.h>
12 #include "pal_compiler.h"
13 #include "pal_config.h"
14 #include "pal_errno.h"
15 #include "pal_utilities.h"
17 #include "pal-android.h"
19 int32_t SystemNative_Read(intptr_t fd, void* buffer, int32_t bufferSize)
21 assert(buffer != NULL || bufferSize == 0);
22 assert(bufferSize >= 0);
24 if (bufferSize < 0)
26 errno = EINVAL;
27 return -1;
30 ssize_t count;
31 count = read(ToFileDescriptor(fd), buffer, (uint32_t)bufferSize);
33 assert(count >= -1 && count <= bufferSize);
34 return (int32_t)count;