diff options
author | Doug Horn <doughorn@google.com> | 2018-11-14 21:04:20 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-11-14 21:04:20 +0000 |
commit | 58d8b7bb7f4cb6375a5e09e9e2fdac828a3a8180 (patch) | |
tree | ee875d8e0f877b5d51fecf0f51bdddd0dd327173 | |
parent | d260231f0cb1148623b3e8b387d28269b8e08d27 (diff) | |
parent | a24267385d320786849d6924002390fd0cd1698f (diff) | |
download | libcore-58d8b7bb7f4cb6375a5e09e9e2fdac828a3a8180.tar.gz |
Merge "Initial libcore fuchsia support."android-o-mr1-iot-release-smart-display-r9android-o-mr1-iot-release-smart-display-r8android-o-mr1-iot-release-smart-display-r5android-o-mr1-iot-release-smart-display-r4android-o-mr1-iot-release-smart-clock-r6android-o-mr1-iot-release-smart-clock-r2android-o-mr1-iot-release-smart-clock-fsiandroid-o-mr1-iot-release-smart-clock-fcsandroid-o-mr1-iot-release-cube_r2android-o-mr1-iot-release-cube-fsiandroid-o-mr1-iot-release-cube-fcs
-rw-r--r-- | ojluni/src/main/native/LinuxWatchService.c | 6 | ||||
-rw-r--r-- | ojluni/src/main/native/NativeThread.c | 7 | ||||
-rw-r--r-- | ojluni/src/main/native/Net.c | 18 | ||||
-rw-r--r-- | ojluni/src/main/native/UNIXProcess_md.c | 4 | ||||
-rw-r--r-- | ojluni/src/main/native/UnixNativeDispatcher.c | 4 | ||||
-rw-r--r-- | ojluni/src/main/native/io_util_md.c | 8 | ||||
-rw-r--r-- | ojluni/src/main/native/jvm_md.h | 6 | ||||
-rw-r--r-- | ojluni/src/main/native/linux_close.cpp | 10 | ||||
-rw-r--r-- | ojluni/src/main/native/net_util_md.h | 11 |
9 files changed, 70 insertions, 4 deletions
diff --git a/ojluni/src/main/native/LinuxWatchService.c b/ojluni/src/main/native/LinuxWatchService.c index 375aaa48505..1f531d08d4b 100644 --- a/ojluni/src/main/native/LinuxWatchService.c +++ b/ojluni/src/main/native/LinuxWatchService.c @@ -32,8 +32,14 @@ #include <dlfcn.h> #include <sys/types.h> #include <sys/socket.h> +// Android-changed: Fuchsia: Point to correct location of header. http://b/119426171 +// #include <sys/poll.h> +#if defined(__Fuchsia__) +#include <poll.h> +#else #include <sys/poll.h> #include <sys/inotify.h> +#endif #include "sun_nio_fs_LinuxWatchService.h" diff --git a/ojluni/src/main/native/NativeThread.c b/ojluni/src/main/native/NativeThread.c index 3a1c5c1b9a4..dc21e5dbc90 100644 --- a/ojluni/src/main/native/NativeThread.c +++ b/ojluni/src/main/native/NativeThread.c @@ -48,6 +48,13 @@ #include <signal.h> /* Also defined in net/bsd_close.c */ #define INTERRUPT_SIGNAL SIGIO +// BEGIN Android-added: Fuchsia: Support for Fuchsia platform. +#elif __Fuchsia__ + #include <pthread.h> + #include <signal.h> + /* Also defined in net/bsd_close.c */ + #define INTERRUPT_SIGNAL SIGIO +// END Android-added: Fuchsia: Support for Fuchsia platform. #else #error "missing platform-specific definition here" #endif diff --git a/ojluni/src/main/native/Net.c b/ojluni/src/main/native/Net.c index 462830dab46..bcf984e957b 100644 --- a/ojluni/src/main/native/Net.c +++ b/ojluni/src/main/native/Net.c @@ -23,7 +23,13 @@ * questions. */ +// Android-changed: Fuchsia: Point to correct location of header. http://b/119426171 +// #include <sys/poll.h> +#if defined(__Fuchsia__) +#include <poll.h> +#else #include <sys/poll.h> +#endif #include <sys/types.h> #include <sys/socket.h> #include <string.h> @@ -374,7 +380,13 @@ Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo) struct sockaddr_in *sin; sin = (struct sockaddr_in *) &sa; bzero(sin, sizeof(*sin)); + // BEGIN Android-changed: Fuchsia: sin_len is not a sockaddr_in member on Fuchsia. + // http://b/119497331 + // sin->sin_len = sizeof(struct sockaddr_in); +#if !defined(__Fuchsia__) sin->sin_len = sizeof(struct sockaddr_in); +#endif + // END Android-changed: Fuchsia: sin_len is not a sockaddr_in member on Fuchsia. sin->sin_family = AF_INET; sin->sin_port = htonl(0); sin->sin_addr.s_addr = INADDR_ANY; @@ -409,7 +421,13 @@ Java_sun_nio_ch_Net_localInetAddress(JNIEnv *env, jclass clazz, jobject fdo) struct sockaddr_in *sin; sin = (struct sockaddr_in *) &sa; bzero(sin, sizeof(*sin)); + // BEGIN Android-changed: Fuchsia: sin_len is not a sockaddr_in member on Fuchsia. + // http://b/119497331 + // sin->sin_len = sizeof(struct sockaddr_in); +#if !defined(__Fuchsia__) sin->sin_len = sizeof(struct sockaddr_in); +#endif + // END Android-changed: Fuchsia: sin_len is not a sockaddr_in member on Fuchsia. sin->sin_family = AF_INET; sin->sin_port = htonl(0); sin->sin_addr.s_addr = INADDR_ANY; diff --git a/ojluni/src/main/native/UNIXProcess_md.c b/ojluni/src/main/native/UNIXProcess_md.c index 9d869b9d992..807a915bdce 100644 --- a/ojluni/src/main/native/UNIXProcess_md.c +++ b/ojluni/src/main/native/UNIXProcess_md.c @@ -44,7 +44,9 @@ #include <stdlib.h> #include <sys/types.h> #include <ctype.h> -#ifdef _ALLBSD_SOURCE +// Android-changed: Fuchsia: Point to correct location of header. http://b/119426171 +// #ifdef _ALLBSD_SOURCE +#if defined(_ALLBSD_SOURCE) && !defined(__Fuchsia__) #include <wait.h> #else #include <sys/wait.h> diff --git a/ojluni/src/main/native/UnixNativeDispatcher.c b/ojluni/src/main/native/UnixNativeDispatcher.c index e8a1623a87d..1853a2ca850 100644 --- a/ojluni/src/main/native/UnixNativeDispatcher.c +++ b/ojluni/src/main/native/UnixNativeDispatcher.c @@ -46,7 +46,9 @@ #include <string.h> #endif -#ifdef _ALLBSD_SOURCE +// Android-changed: Fuchsia: Alias *64 on Fuchsia builds. http://b/119496969 +// #ifdef _ALLBSD_SOURCE +#if defined(_ALLBSD_SOURCE) || defined(__Fuchsia__) #include <string.h> #define stat64 stat diff --git a/ojluni/src/main/native/io_util_md.c b/ojluni/src/main/native/io_util_md.c index 8b8a6873cb9..39ceb4ae0c2 100644 --- a/ojluni/src/main/native/io_util_md.c +++ b/ojluni/src/main/native/io_util_md.c @@ -30,6 +30,14 @@ #include "io_util_md.h" #include <string.h> +// BEGIN Android-added: Fuchsia: Alias *64 functions on Fuchsia. http://b/119496969 +#if defined(__Fuchsia__) +#define stat64 stat +#define fstat64 fstat +#define open64 open +#endif +// END Android-added: Fuchsia: Alias *64 functions on Fuchsia. http://b/119496969 + #ifdef MACOSX #include <CoreFoundation/CoreFoundation.h> diff --git a/ojluni/src/main/native/jvm_md.h b/ojluni/src/main/native/jvm_md.h index a3664456873..54743c64de1 100644 --- a/ojluni/src/main/native/jvm_md.h +++ b/ojluni/src/main/native/jvm_md.h @@ -65,7 +65,13 @@ #include <sys/stat.h> #include <fcntl.h> #include <errno.h> +// Android-changed: Fuchsia: Point to correct header location. http://b/119426171 +// #include <sys/signal.h> +#if !defined(__Fuchsia__) #include <sys/signal.h> +#else +#include <signal.h> +#endif /* O Flags */ diff --git a/ojluni/src/main/native/linux_close.cpp b/ojluni/src/main/native/linux_close.cpp index e100035f30e..5b4829289bb 100644 --- a/ojluni/src/main/native/linux_close.cpp +++ b/ojluni/src/main/native/linux_close.cpp @@ -30,12 +30,22 @@ #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> +// Android-changed: Fuchsia: Drop #include of resource.h absent on Fuchsia. http://b/119433484 +// #include <sys/resource.h> +#if !defined(__Fuchsia__) #include <sys/resource.h> +#endif #include <sys/uio.h> #include <unistd.h> #include <errno.h> +// Android-changed: Fuchsia: Fix poll.h include location +// #include <sys/poll.h> +#if !defined(__Fuchsia__) #include <sys/poll.h> +#else +#include <poll.h> +#endif #include <nativehelper/AsynchronousCloseMonitor.h> diff --git a/ojluni/src/main/native/net_util_md.h b/ojluni/src/main/native/net_util_md.h index 94a8877fe02..0bef5b99964 100644 --- a/ojluni/src/main/native/net_util_md.h +++ b/ojluni/src/main/native/net_util_md.h @@ -33,11 +33,18 @@ #include <unistd.h> #ifndef USE_SELECT +// Android-changed: Fuchsia: Point to correct location of header. http://b/119426171 +// #include <sys/poll.h> +#if !defined(__Fuchsia__) #include <sys/poll.h> +#else +#include <poll.h> +#endif #endif - -#if defined(__linux__) || defined(MACOSX) +// Android-changed: Fuchsia: Use the non-JVM NET_* on Fuchsia also. +// #if defined(__linux__) || defined(MACOSX) +#if defined(__linux__) || defined(MACOSX) || defined(__Fuchsia__) extern int NET_Timeout(int s, long timeout); extern int NET_Read(int s, void* buf, size_t len); extern int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, |