]> git.pld-linux.org Git - packages/systemd.git/blob - udev-uClibc.patch
- rel 14
[packages/systemd.git] / udev-uClibc.patch
1 diff -ur udev-150/src/ata_id/ata_id.c udev-150-uclibc/src/ata_id/ata_id.c
2 --- udev-150/src/ata_id/ata_id.c        2009-12-08 18:43:09.000000000 +0100
3 +++ udev-150-uclibc/src/ata_id/ata_id.c        2010-01-19 17:10:19.000000000 +0100
4 @@ -168,7 +168,11 @@
5          uint16_t *p;
6  
7          p = (uint16_t *) identify;
8 +#ifdef __UCLIBC__
9 +        p[offset_words] = __le16_to_cpu (p[offset_words]);
10 +#else
11          p[offset_words] = le16toh (p[offset_words]);
12 +#endif
13  }
14  
15  /**
16 diff -ur udev-150/src/udevadm-info.c udev-150-uclibc/src/udevadm-info.c
17 --- udev-150/src/udevadm-info.c        2009-12-24 20:40:34.000000000 +0100
18 +++ udev-150-uclibc/src/udevadm-info.c        2010-01-19 17:47:00.000000000 +0100
19 @@ -200,8 +200,14 @@
20          return 0;
21  }
22  
23 +#ifdef __UCLIBC__
24 +static void cleanup_dir(DIR *dir, char *dirname, mode_t mask, int depth)
25 +{
26 +        char filename[UTIL_PATH_SIZE];
27 +#else
28  static void cleanup_dir(DIR *dir, mode_t mask, int depth)
29  {
30 +#endif
31          struct dirent *dent;
32  
33          if (depth <= 0)
34 @@ -212,7 +215,12 @@
35  
36                  if (dent->d_name[0] == '.')
37                          continue;
38 +#ifdef __UCLIBC__
39 +                util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL);
40 +                if (lstat(filename, &stats) != 0)
41 +#else
42                  if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0)
43 +#endif
44                          continue;
45                  if ((stats.st_mode & mask) != 0)
46                          continue;
47 @@ -229,7 +232,11 @@
48  
49                          dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
50                          if (dir2 != NULL) {
51 +#ifdef __UCLIBC__
52 +                                cleanup_dir(dir2, filename, mask, depth-1);
53 +#else
54                                  cleanup_dir(dir2, mask, depth-1);
55 +#endif
56                                  closedir(dir2);
57                          }
58                          unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR);
59 @@ -250,35 +257,55 @@
60          util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL);
61          dir = opendir(filename);
62          if (dir != NULL) {
63 +#ifdef __UCLIBC__
64 +                cleanup_dir(dir, filename, S_ISVTX, 1);
65 +#else
66                  cleanup_dir(dir, S_ISVTX, 1);
67 +#endif
68                  closedir(dir);
69          }
70  
71          util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/links", NULL);
72          dir = opendir(filename);
73          if (dir != NULL) {
74 +#ifdef __UCLIBC__
75 +                cleanup_dir(dir, filename, 0, 2);
76 +#else
77                  cleanup_dir(dir, 0, 2);
78 +#endif
79                  closedir(dir);
80          }
81  
82          util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags", NULL);
83          dir = opendir(filename);
84          if (dir != NULL) {
85 +#ifdef __UCLIBC__
86 +                cleanup_dir(dir, filename, 0, 2);
87 +#else
88                  cleanup_dir(dir, 0, 2);
89 +#endif
90                  closedir(dir);
91          }
92  
93          util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL);
94          dir = opendir(filename);
95          if (dir != NULL) {
96 +#ifdef __UCLIBC__
97 +                cleanup_dir(dir, filename, 0, 1);
98 +#else
99                  cleanup_dir(dir, 0, 1);
100 +#endif
101                  closedir(dir);
102          }
103  
104          util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/firmware-missing", NULL);
105          dir = opendir(filename);
106          if (dir != NULL) {
107 +#ifdef __UCLIBC__
108 +                cleanup_dir(dir, filename, 0, 1);
109 +#else
110                  cleanup_dir(dir, 0, 1);
111 +#endif
112                  closedir(dir);
113          }
114  }
115 --- udev-168/src/udev-event.c.orig        2011-04-21 14:05:13.000000000 +0200
116 +++ udev-168/src/udev-event.c        2011-04-26 01:09:16.813273489 +0200
117 @@ -508,11 +508,18 @@
118          if (fd_stdout < 0 && fd_stderr < 0)
119                  return;
120  
121 +#ifdef __UCLIBC__
122 +        fd_ep = epoll_create(1);
123 +#else
124          fd_ep = epoll_create1(EPOLL_CLOEXEC);
125 +#endif
126          if (fd_ep < 0) {
127                  err(udev, "error creating epoll fd: %m\n");
128                  goto out;
129          }
130 +#ifdef __UCLIBC__
131 +        fcntl(fd_ep, F_SETFD, FD_CLOEXEC);
132 +#endif
133  
134          if (fd_stdout >= 0) {
135                  memset(&ep_outpipe, 0, sizeof(struct epoll_event));
136 @@ -698,9 +698,11 @@
137                                  } else if (WIFSTOPPED(status)) {
138                                          err(udev, "'%s' [%u] stopped\n", cmd, pid);
139                                          err = -1;
140 +#ifdef WIFCONTINUED
141                                  } else if (WIFCONTINUED(status)) {
142                                          err(udev, "'%s' [%u] continued\n", cmd, pid);
143                                          err = -1;
144 +#endif
145                                  } else {
146                                          err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status);
147                                          err = -1;
148 @@ -759,18 +759,34 @@
149  
150          /* pipes from child to parent */
151          if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) {
152 +#ifdef __UCLIBC__
153 +                if (pipe(outpipe) != 0) {
154 +#else
155                  if (pipe2(outpipe, O_NONBLOCK) != 0) {
156 +#endif
157                          err = -errno;
158                          err(udev, "pipe failed: %m\n");
159                          goto out;
160                  }
161 +#ifdef __UCLIBC__
162 +                fcntl(outpipe[0], F_SETFL, O_NONBLOCK);
163 +                fcntl(outpipe[1], F_SETFL, O_NONBLOCK);
164 +#endif
165          }
166          if (udev_get_log_priority(udev) >= LOG_INFO) {
167 +#ifdef __UCLIBC__
168 +                if (pipe(errpipe) != 0) {
169 +#else
170                  if (pipe2(errpipe, O_NONBLOCK) != 0) {
171 +#endif
172                          err = -errno;
173                          err(udev, "pipe failed: %m\n");
174                          goto out;
175                  }
176 +#ifdef __UCLIBC__
177 +                fcntl(errpipe[0], F_SETFL, O_NONBLOCK);
178 +                fcntl(errpipe[1], F_SETFL, O_NONBLOCK);
179 +#endif
180          }
181  
182          /* allow programs in /lib/src/ to be called without the path */
183 --- udev-168/src/udevd.c.orig        2011-04-21 14:05:13.000000000 +0200
184 +++ udev-168/src/udevd.c        2011-04-26 01:13:39.984103209 +0200
185 @@ -256,12 +256,19 @@
186                          goto out;
187                  }
188  
189 +#ifdef __UCLIBC__
190 +                fd_ep = epoll_create(1);
191 +#else
192                  fd_ep = epoll_create1(EPOLL_CLOEXEC);
193 +#endif
194                  if (fd_ep < 0) {
195                          err(udev, "error creating epoll fd: %m\n");
196                          rc = 3;
197                          goto out;
198                  }
199 +#ifdef __UCLIBC__
200 +                fcntl(fd_ep, F_SETFD, FD_CLOEXEC);
201 +#endif
202  
203                  memset(&ep_signal, 0, sizeof(struct epoll_event));
204                  ep_signal.events = EPOLLIN;
205 @@ -826,8 +826,10 @@
206                                              pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
207                                  } else if (WIFSTOPPED(status)) {
208                                          err(udev, "worker [%u] stopped\n", pid);
209 +#ifdef WIFCONTINUED
210                                  } else if (WIFCONTINUED(status)) {
211                                          err(udev, "worker [%u] continued\n", pid);
212 +#endif
213                                  } else {
214                                          err(udev, "worker [%u] exit with status 0x%04x\n", pid, status);
215                                  }
216 @@ -1547,11 +1554,18 @@
217          ep_worker.events = EPOLLIN;
218          ep_worker.data.fd = fd_worker;
219  
220 +#ifdef __UCLIBC__
221 +        fd_ep = epoll_create(1);
222 +#else
223          fd_ep = epoll_create1(EPOLL_CLOEXEC);
224 +#endif
225          if (fd_ep < 0) {
226                  err(udev, "error creating epoll fd: %m\n");
227                  goto exit;
228          }
229 +#ifdef __UCLIBC__
230 +        fcntl(fd_ep, F_SETFD, FD_CLOEXEC);
231 +#endif
232          if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 ||
233              epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_inotify, &ep_inotify) < 0 ||
234              epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 ||
235 --- udev-172/src/udev-ctrl.c.orig        2011-04-26 01:20:36.150103207 +0200
236 +++ udev-172/src/udev-ctrl.c        2011-04-26 01:21:48.940103224 +0200
237 @@ -15,6 +15,7 @@
238  #include <stddef.h>
239  #include <string.h>
240  #include <unistd.h>
241 +#include <fcntl.h>
242  #include <sys/types.h>
243  #include <sys/poll.h>
244  #include <sys/socket.h>
245 @@ -187,13 +187,22 @@
246          conn->refcount = 1;
247          conn->uctrl = uctrl;
248  
249 +#ifdef __UCLIBC__
250 +        conn->sock = accept(uctrl->sock, NULL, NULL);
251 +#else
252          conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
253 +#endif
254          if (conn->sock < 0) {
255                  if (errno != EINTR)
256                          err(uctrl->udev, "unable to receive ctrl connection: %m\n");
257                  goto err;
258          }
259  
260 +#ifdef __UCLIBC__
261 +        fcntl(conn->sock, F_SETFD, FD_CLOEXEC);
262 +        fcntl(conn->sock, F_SETFL, O_NONBLOCK);
263 +#endif
264 +
265          /* check peer credential of connection */
266          slen = sizeof(ucred);
267          if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) {
268 --- udev-168/src/udevadm-monitor.c.orig        2011-04-26 01:53:44.361103209 +0200
269 +++ udev-168/src/udevadm-monitor.c        2011-04-26 01:54:41.946103207 +0200
270 @@ -157,11 +157,18 @@
271          sigaddset(&mask, SIGTERM);
272          sigprocmask(SIG_UNBLOCK, &mask, NULL);
273  
274 +#ifdef __UCLIBC__
275 +        fd_ep = epoll_create(1);
276 +#else
277          fd_ep = epoll_create1(EPOLL_CLOEXEC);
278 +#endif
279          if (fd_ep < 0) {
280                  err(udev, "error creating epoll fd: %m\n");
281                  goto out;
282          }
283 +#ifdef __UCLIBC__
284 +        fcntl(fd_ep, F_SETFD, FD_CLOEXEC);
285 +#endif
286  
287          printf("monitor will print the received events for:\n");
288          if (print_udev) {
This page took 0.442129 seconds and 3 git commands to generate.