Bug 963023 - AArch64 support for libevent. r=froydnj

This commit is contained in:
Marcin Juszkiewicz 2014-02-12 10:07:48 -05:00
parent c13202e00f
commit 123bc240c1
3 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,43 @@
---
ipc/chromium/src/third_party/libevent/epoll_sub.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- mozilla-central.orig/ipc/chromium/src/third_party/libevent/epoll_sub.c
+++ mozilla-central/ipc/chromium/src/third_party/libevent/epoll_sub.c
@@ -29,15 +29,24 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/epoll.h>
#include <unistd.h>
+#include <errno.h>
int
epoll_create(int size)
{
+#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1)
+ if (size <= 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ return (syscall(__NR_epoll_create1, 0));
+#else
return (syscall(__NR_epoll_create, size));
+#endif
}
int
epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
{
@@ -46,7 +55,11 @@ epoll_ctl(int epfd, int op, int fd, stru
}
int
epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
{
+#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait)
+ return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
+#else
return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
+#endif
}

View File

@ -13,3 +13,5 @@ These files are taken from libevent-2.0.21-stable built on the development envir
3. Apply "add mac-arc4random-buf.patch", which removes some bad OS X compatibility code. This will allow libevent to compile on all supported versions of OS X.
4. Apply "openbsd-no-arc4random_addrandom.patch", which fixes the build on OpenBSD (which doesnt provide arc4random_addrandom anymore, see #931354)
5. Apply "libevent-use-non-deprecated-syscalls.patch", which fixes the build on AArch64 architecture (which does not provide deprecated syscalls)

View File

@ -31,11 +31,20 @@
#include <sys/syscall.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <errno.h>
int
epoll_create(int size)
{
#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1)
if (size <= 0) {
errno = EINVAL;
return -1;
}
return (syscall(__NR_epoll_create1, 0));
#else
return (syscall(__NR_epoll_create, size));
#endif
}
int
@ -48,5 +57,9 @@ epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
int
epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
{
#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait)
return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
#else
return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
#endif
}