package/dhcp/S80dhcp-server: allow empty INTERFACES
[buildroot-gz.git] / package / acpid / 0003-support-for-non-glibc-libcs.patch
blobf152d32c1d6160f7f54c797324676cb859977412
1 From a3dac1c3cee169e52c7d644dd565235a1cd833e3 Mon Sep 17 00:00:00 2001
2 From: Brendan Heading <brendanheading@gmail.com>
3 Date: Wed, 22 Jul 2015 23:10:11 +0100
4 Subject: [PATCH] support for non-glibc libcs
6 Added a TEMP_FAILURE_RETRY macro. This is a glibcism provided by
7 glibc and uclibc, but missing from musl (& possibly other libcs).
9 Upstream-status: submitted (see https://sourceforge.net/p/acpid2/tickets/7/)
10 ---
11 acpi_listen.c | 2 ++
12 acpid.c | 1 +
13 event.c | 2 ++
14 input_layer.c | 1 +
15 kacpimon/libnetlink.h | 2 ++
16 libc_compat.h | 40 ++++++++++++++++++++++++++++++++++++++++
17 libnetlink.c | 2 ++
18 netlink.c | 1 +
19 proc.c | 1 +
20 ud_socket.c | 1 +
21 10 files changed, 53 insertions(+)
22 create mode 100644 libc_compat.h
24 diff --git a/acpi_listen.c b/acpi_listen.c
25 index d0bc175..839e4f9 100644
26 --- a/acpi_listen.c
27 +++ b/acpi_listen.c
28 @@ -39,6 +39,8 @@
29 #include "acpid.h"
30 #include "ud_socket.h"
32 +#include "libc_compat.h"
34 static int handle_cmdline(int *argc, char ***argv);
35 static char *read_line(int fd);
37 diff --git a/acpid.c b/acpid.c
38 index 23f1e58..8555c82 100644
39 --- a/acpid.c
40 +++ b/acpid.c
41 @@ -41,6 +41,7 @@
42 #include "input_layer.h"
43 #include "inotify_handler.h"
44 #include "netlink.h"
45 +#include "libc_compat.h"
47 static int handle_cmdline(int *argc, char ***argv);
48 static void close_fds(void);
49 diff --git a/event.c b/event.c
50 index 324078f..3b069a2 100644
51 --- a/event.c
52 +++ b/event.c
53 @@ -39,6 +39,8 @@
54 #include "log.h"
55 #include "sock.h"
56 #include "ud_socket.h"
57 +#include "libc_compat.h"
59 #include "event.h"
61 * What is a rule? It's polymorphic, pretty much.
62 diff --git a/input_layer.c b/input_layer.c
63 index 9aa19c6..cbf8085 100644
64 --- a/input_layer.c
65 +++ b/input_layer.c
66 @@ -42,6 +42,7 @@
67 #include "log.h"
68 #include "connection_list.h"
69 #include "event.h"
70 +#include "libc_compat.h"
72 #include "input_layer.h"
74 diff --git a/kacpimon/libnetlink.h b/kacpimon/libnetlink.h
75 index 6185cbc..0c61896 100644
76 --- a/kacpimon/libnetlink.h
77 +++ b/kacpimon/libnetlink.h
78 @@ -7,6 +7,8 @@
79 #include <linux/netlink.h>
80 #include <linux/rtnetlink.h>
82 +#include "libc_compat.h"
84 struct rtnl_handle
86 int fd;
87 diff --git a/libc_compat.h b/libc_compat.h
88 new file mode 100644
89 index 0000000..39f2336
90 --- /dev/null
91 +++ b/libc_compat.h
92 @@ -0,0 +1,40 @@
93 +/*
94 + * libc_compat.h - implement defs/macros missing from some libcs
95 + *
96 + * Copyright (C) 1999-2000 Andrew Henroid
97 + * Copyright (C) 2001 Sun Microsystems
98 + * Portions Copyright (C) 2004 Tim Hockin (thockin@hockin.org)
99 + *
100 + * This program is free software; you can redistribute it and/or modify
101 + * it under the terms of the GNU General Public License as published by
102 + * the Free Software Foundation; either version 2 of the License, or
103 + * (at your option) any later version.
105 + * This program is distributed in the hope that it will be useful,
106 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
107 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
108 + * GNU General Public License for more details.
110 + * You should have received a copy of the GNU General Public License
111 + * along with this program; if not, write to the Free Software
112 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
113 + */
115 +#ifndef LIBC_COMPAT_H__
116 +#define LIBC_COMPAT_H__
118 +/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
119 + set to EINTR. This macro is present on glibc/uclibc but may not be in other cases. */
121 +#ifndef ____GLIBC__
122 +#ifndef TEMP_FAILURE_RETRY
123 +#define TEMP_FAILURE_RETRY(expression) \
124 + (__extension__ \
125 + ({ long int __result; \
126 + do __result = (long int) (expression); \
127 + while (__result == -1L && errno == EINTR); \
128 + __result; }))
129 +#endif
130 +#endif /* __GLIBC__ */
132 +#endif /* LIBC_COMPAT_H__ */
133 diff --git a/libnetlink.c b/libnetlink.c
134 index e61d417..cc7aedc 100644
135 --- a/libnetlink.c
136 +++ b/libnetlink.c
137 @@ -24,6 +24,8 @@
138 #include <time.h>
139 #include <sys/uio.h>
141 +#include "libc_compat.h"
143 #include "libnetlink.h"
145 void rtnl_close(struct rtnl_handle *rth)
146 diff --git a/netlink.c b/netlink.c
147 index c64e878..27e3536 100644
148 --- a/netlink.c
149 +++ b/netlink.c
150 @@ -41,6 +41,7 @@
151 #include "libnetlink.h"
152 #include "genetlink.h"
153 #include "acpi_genetlink.h"
154 +#include "libc_compat.h"
156 #include "acpi_ids.h"
157 #include "connection_list.h"
158 diff --git a/proc.c b/proc.c
159 index 5bb8fa2..f96b913 100644
160 --- a/proc.c
161 +++ b/proc.c
162 @@ -31,6 +31,7 @@
163 #include "log.h"
164 #include "event.h"
165 #include "connection_list.h"
166 +#include "libc_compat.h"
168 #include "proc.h"
170 diff --git a/ud_socket.c b/ud_socket.c
171 index 2790686..1790917 100644
172 --- a/ud_socket.c
173 +++ b/ud_socket.c
174 @@ -21,6 +21,7 @@
175 #include "acpid.h"
176 #include "log.h"
177 #include "ud_socket.h"
178 +#include "libc_compat.h"
181 ud_create_socket(const char *name, mode_t socketmode)
183 2.4.3