mozilla-aarch64-bmo-963023.patch
changeset 718 6cb1ac7cd223
parent 716 cef565f1c325
child 719 8d80a56bb0a8
equal deleted inserted replaced
716:cef565f1c325 718:6cb1ac7cd223
     1 
       
     2 # HG changeset patch
       
     3 # User Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
       
     4 # Date 1392217668 18000
       
     5 # Node ID 4e9b713f435ade266a68a8d7ba08aad65c3fa6c5
       
     6 # Parent  282b6e88f9d4c2367a72836f6f9efeab2aadaa58
       
     7 Bug 963023 - AArch64 support for libevent. r=froydnj
       
     8 
       
     9 diff --git a/ipc/chromium/src/third_party/libevent-use-non-deprecated-syscalls.patch b/ipc/chromium/src/third_party/libevent-use-non-deprecated-syscalls.patch
       
    10 new file mode 100644
       
    11 --- /dev/null
       
    12 +++ b/ipc/chromium/src/third_party/libevent-use-non-deprecated-syscalls.patch
       
    13 @@ -0,0 +1,43 @@
       
    14 +---
       
    15 + ipc/chromium/src/third_party/libevent/epoll_sub.c |   13 +++++++++++++
       
    16 + 1 file changed, 13 insertions(+)
       
    17 +
       
    18 +--- mozilla-central.orig/ipc/chromium/src/third_party/libevent/epoll_sub.c
       
    19 ++++ mozilla-central/ipc/chromium/src/third_party/libevent/epoll_sub.c
       
    20 +@@ -29,15 +29,24 @@
       
    21 + #include <sys/param.h>
       
    22 + #include <sys/types.h>
       
    23 + #include <sys/syscall.h>
       
    24 + #include <sys/epoll.h>
       
    25 + #include <unistd.h>
       
    26 ++#include <errno.h>
       
    27 +
       
    28 + int
       
    29 + epoll_create(int size)
       
    30 + {
       
    31 ++#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1)
       
    32 ++	if (size <= 0) {
       
    33 ++		errno = EINVAL;
       
    34 ++		return -1;
       
    35 ++	}
       
    36 ++	return (syscall(__NR_epoll_create1, 0));
       
    37 ++#else
       
    38 + 	return (syscall(__NR_epoll_create, size));
       
    39 ++#endif
       
    40 + }
       
    41 +
       
    42 + int
       
    43 + epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
       
    44 + {
       
    45 +@@ -46,7 +55,11 @@ epoll_ctl(int epfd, int op, int fd, stru
       
    46 + }
       
    47 +
       
    48 + int
       
    49 + epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
       
    50 + {
       
    51 ++#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait)
       
    52 ++	return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
       
    53 ++#else
       
    54 + 	return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
       
    55 ++#endif
       
    56 + }
       
    57 diff --git a/ipc/chromium/src/third_party/libevent/README.mozilla b/ipc/chromium/src/third_party/libevent/README.mozilla
       
    58 --- a/ipc/chromium/src/third_party/libevent/README.mozilla
       
    59 +++ b/ipc/chromium/src/third_party/libevent/README.mozilla
       
    60 @@ -8,8 +8,10 @@ android/event2/event-config.h
       
    61  
       
    62  These files are taken from libevent-2.0.21-stable built on the development environment indicated by the first path component. You have to run "./configure" and "make" to get all of the pre-processing done. The file can then be found in "include/event2/".
       
    63  
       
    64  2. This is ugly, prepare yourself. OS X has a weird problem with how the "TAILQ_END(head)" is used, causing a linking error. Just replace all use of the "TAILQ_END(head)" macro with "NULL".
       
    65  
       
    66  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.
       
    67  
       
    68  4. Apply "openbsd-no-arc4random_addrandom.patch", which fixes the build on OpenBSD (which doesnt provide arc4random_addrandom anymore, see #931354)
       
    69 +
       
    70 +5. Apply "libevent-use-non-deprecated-syscalls.patch", which fixes the build on AArch64 architecture (which does not provide deprecated syscalls)
       
    71 diff --git a/ipc/chromium/src/third_party/libevent/epoll_sub.c b/ipc/chromium/src/third_party/libevent/epoll_sub.c
       
    72 --- a/ipc/chromium/src/third_party/libevent/epoll_sub.c
       
    73 +++ b/ipc/chromium/src/third_party/libevent/epoll_sub.c
       
    74 @@ -26,27 +26,40 @@
       
    75   */
       
    76  #include <stdint.h>
       
    77  
       
    78  #include <sys/param.h>
       
    79  #include <sys/types.h>
       
    80  #include <sys/syscall.h>
       
    81  #include <sys/epoll.h>
       
    82  #include <unistd.h>
       
    83 +#include <errno.h>
       
    84  
       
    85  int
       
    86  epoll_create(int size)
       
    87  {
       
    88 +#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1)
       
    89 +	if (size <= 0) {
       
    90 +		errno = EINVAL;
       
    91 +		return -1;
       
    92 +	}
       
    93 +	return (syscall(__NR_epoll_create1, 0));
       
    94 +#else
       
    95  	return (syscall(__NR_epoll_create, size));
       
    96 +#endif
       
    97  }
       
    98  
       
    99  int
       
   100  epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
       
   101  {
       
   102  
       
   103  	return (syscall(__NR_epoll_ctl, epfd, op, fd, event));
       
   104  }
       
   105  
       
   106  int
       
   107  epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
       
   108  {
       
   109 +#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait)
       
   110 +	return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
       
   111 +#else
       
   112  	return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
       
   113 +#endif
       
   114  }
       
   115