Dash:
[t2-trunk.git] / package / base / dietlibc / pselect.patch
blob55e9444e58a1d6f26d8b1c0208e9b77212b381b3
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../dietlibc/pselect.patch
5 # Copyright (C) 2011 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 The emulation via legacy syscalls fails atomic tests, ...
19 - Rene Rebe <rene@exactcode.de>
21 --- dietlibc-0.32-vanilla/lib/pselect.c 2004-05-17 17:44:56.000000000 +0000
22 +++ dietlibc-0.32/lib/pselect.c 2011-01-09 18:17:03.314803895 +0000
23 @@ -1,20 +1,17 @@
24 #include <sys/select.h>
26 -int pselect(int n, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
27 - const struct timespec *timeout, const sigset_t *sigmask) {
28 - struct timeval t;
29 - sigset_t old;
30 - int r;
31 - if (timeout) {
32 - t.tv_sec=timeout->tv_sec;
33 - t.tv_usec=timeout->tv_nsec/1000;
34 - if (!t.tv_sec && !t.tv_usec && timeout->tv_nsec) ++t.tv_usec;
35 - }
36 - if (sigmask)
37 - sigprocmask(SIG_SETMASK,sigmask,&old);
38 - r=select(n,readfds,writefds,exceptfds,
39 - timeout?&t:0);
40 - if (sigmask)
41 - sigprocmask(SIG_SETMASK,&old,0);
42 - return r;
43 +int __pselect(int n, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
44 + const struct timespec *timeout, void* proxy);
45 +int __libc_pselect(int n, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
46 + const struct timespec *timeout, const sigset_t *sigmask) {
47 + struct {
48 + const sigset_t *sigmask;
49 + size_t nr;
50 + } proxy = {sigmask, _NSIG/8};
52 + return __pselect(n,readfds,writefds,exceptfds, timeout, &proxy);
55 +int pselect(int n, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
56 + const struct timespec *timeout, const sigset_t *sigmask)
57 +__attribute__((weak,alias("__libc_pselect")));
58 diff -urN dietlibc-0.32-vanilla/syscalls.s/__pselect.S dietlibc-0.32/syscalls.s/__pselect.S
59 --- dietlibc-0.32-vanilla/syscalls.s/__pselect.S 1970-01-01 00:00:00.000000000 +0000
60 +++ dietlibc-0.32/syscalls.s/__pselect.S 2011-01-09 18:04:11.126794569 +0000
61 @@ -0,0 +1,3 @@
62 +#include "syscalls.h"
64 +syscall(pselect6,__pselect)