Am Mittwoch, den 11.05.2011, 07:58 +0200 schrieb Thierry Reding: > * Paul Menzel wrote:
[…] > > I am no uClibc expert, but do you know if uClibc will provide > > `EPOLL_CLOEXEC` in the near future? How should systemd fix that? > > uClibc is also missing an implementation of the epoll_create1() syscall. I'm > using a patch against uClibc to fix a similar issue in udev but haven't > gotten around to sending it upstream yet. meta-openembedded successfully applies the following patches [1][2] (also attached) to compile systemd using uClibc. There were some discussions on the mailing list which you should find in the archive [3][4]. Would you accept such patches for upstream inclusion or do you have different ideas? I put the patch authors into CC. Thanks, Paul [1] http://cgit.openembedded.org/cgit.cgi/meta-openembedded/tree/meta-oe/recipes-core/systemd/systemd [2] http://cgit.openembedded.org/cgit.cgi/meta-openembedded/log/meta-oe/recipes-core/systemd/ [3] http://lists.linuxtogo.org/pipermail/openembedded-devel/2011-June/ [4] http://lists.linuxtogo.org/pipermail/openembedded-devel/2011-July/
From ef5128ced42e89514c36a6fba837d84f0d8c294d Mon Sep 17 00:00:00 2001 From: Koen Kooi <[email protected]> Date: Mon, 27 Jun 2011 15:44:41 +0200 Subject: [PATCH] systemd: disable xml file stuff and introspection Signed-off-by: Koen Kooi <[email protected]> --- Makefile.am | 58 ++-------------------------------------------------------- 1 files changed, 2 insertions(+), 56 deletions(-) diff --git a/Makefile.am b/Makefile.am index bfc1079..f23e060 100644 --- a/Makefile.am +++ b/Makefile.am @@ -216,24 +216,6 @@ dist_dbussystemservice_DATA = \ dist_udevrules_DATA = \ src/99-systemd.rules -dbusinterface_DATA = \ - org.freedesktop.systemd1.Manager.xml \ - org.freedesktop.systemd1.Job.xml \ - org.freedesktop.systemd1.Unit.xml \ - org.freedesktop.systemd1.Service.xml \ - org.freedesktop.systemd1.Socket.xml \ - org.freedesktop.systemd1.Timer.xml \ - org.freedesktop.systemd1.Target.xml \ - org.freedesktop.systemd1.Device.xml \ - org.freedesktop.systemd1.Mount.xml \ - org.freedesktop.systemd1.Automount.xml \ - org.freedesktop.systemd1.Snapshot.xml \ - org.freedesktop.systemd1.Swap.xml \ - org.freedesktop.systemd1.Path.xml \ - org.freedesktop.hostname1.xml \ - org.freedesktop.locale1.xml \ - org.freedesktop.timedate1.xml - dist_bashcompletion_DATA = \ src/systemctl-bash-completion.sh @@ -667,17 +649,10 @@ XML_FILES = \ XML_IN_FILES = \ ${patsubst %.1,%.xml.in,${patsubst %.3,%.xml.in,${patsubst %.5,%.xml.in,${patsubst %.7,%.xml.in,${patsubst %.8,%.xml.in,$(nodist_man_MANS)}}}}} -dist_noinst_DATA = \ - ${XML_FILES:.xml=.html} - -nodist_noinst_DATA = \ - ${XML_IN_FILES:.xml.in=.html} - EXTRA_DIST += \ $(XML_FILES) \ $(XML_IN_FILES) \ - ${nodist_man_MANS:=.in} \ - ${XML_IN_FILES:.xml.in=.html.in} + ${nodist_man_MANS:=.in} systemd_SOURCES = \ src/main.c @@ -1317,7 +1292,6 @@ CLEANFILES = \ $(nodist_systemunit_DATA) \ $(nodist_userunit_DATA) \ $(nodist_man_MANS) \ - ${XML_IN_FILES:.xml.in=.html} \ $(pkgconfigdata_DATA) \ src/org.freedesktop.systemd1.policy @@ -1379,41 +1353,13 @@ man/%.8: man/%.xml man/%.8.in: man/%.xml.in $(XSLTPROC_PROCESS_MAN_IN) -man/%.html: man/%.xml - $(XSLTPROC_PROCESS_HTML) - -man/%.html.in: man/%.xml.in - $(XSLTPROC_PROCESS_HTML_IN) - CLEANFILES += \ $(dist_man_MANS) \ - ${nodist_man_MANS:=.in} \ - ${XML_FILES:.xml=.html} \ - ${XML_IN_FILES:.xml.in=.html.in} + ${nodist_man_MANS:=.in} endif DBUS_PREPROCESS = $(CPP) -P $(DBUS_CFLAGS) -imacros dbus/dbus-protocol.h -org.freedesktop.systemd1.%.xml: systemd - $(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.$* $< [email protected] && \ - $(STRINGS) [email protected] | $(AWK) -f $(srcdir)/introspect.awk | \ - $(DBUS_PREPROCESS) -o $@ - && rm [email protected] - -org.freedesktop.hostname1.xml: systemd-hostnamed - $(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.hostname1 $< [email protected] && \ - $(STRINGS) [email protected] | $(AWK) -f $(srcdir)/introspect.awk | \ - $(DBUS_PREPROCESS) -o $@ - && rm [email protected] - -org.freedesktop.locale1.xml: systemd-localed - $(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.locale1 $< [email protected] && \ - $(STRINGS) [email protected] | $(AWK) -f $(srcdir)/introspect.awk | \ - $(DBUS_PREPROCESS) -o $@ - && rm [email protected] - -org.freedesktop.timedate1.xml: systemd-timedated - $(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.timedate1 $< [email protected] && \ - $(STRINGS) [email protected] | $(AWK) -f $(srcdir)/introspect.awk | \ - $(DBUS_PREPROCESS) -o $@ - && rm [email protected] - CLEANFILES += \ $(dbusinterface_DATA) -- 1.6.6.1
Patch from Henning. %m is a glibc only thing. For uclibc we need to do it differently. So we use static strings instead of mallocing them and free'ing I dont know if upstream systemd have plans to make systemd work on non glibc system libraries if not then this patch would not make sense for upstream Signed-off-by: Khem Raj <[email protected]> Index: git/src/mount-setup.c =================================================================== --- git.orig/src/mount-setup.c 2011-07-03 08:24:43.892018457 -0700 +++ git/src/mount-setup.c 2011-07-03 08:35:23.592956700 -0700 @@ -147,10 +147,11 @@ for (;;) { MountPoint p; - char *controller, *where; + char controller[30]; + char *where; int enabled = false; - if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) { + if (fscanf(f, "%29s %*i %*i %i", controller, &enabled) != 2) { if (feof(f)) break; @@ -161,12 +162,10 @@ } if (!enabled) { - free(controller); continue; } if (asprintf(&where, "/sys/fs/cgroup/%s", controller) < 0) { - free(controller); r = -ENOMEM; goto finish; } @@ -180,7 +179,6 @@ p.fatal = false; r = mount_one(&p); - free(controller); free(where); if (r < 0) Index: git/src/socket-util.c =================================================================== --- git.orig/src/socket-util.c 2011-07-03 08:24:43.892018457 -0700 +++ git/src/socket-util.c 2011-07-03 08:25:38.242098176 -0700 @@ -192,7 +192,7 @@ int socket_address_parse_netlink(SocketAddress *a, const char *s) { int family; unsigned group = 0; - char* sfamily = NULL; + char sfamily[50]; assert(a); assert(s); @@ -200,17 +200,14 @@ a->type = SOCK_RAW; errno = 0; - if (sscanf(s, "%ms %u", &sfamily, &group) < 1) + if (sscanf(s, "%49s %u", &sfamily, &group) < 1) return errno ? -errno : -EINVAL; if ((family = netlink_family_from_string(sfamily)) < 0) if (safe_atoi(sfamily, &family) < 0) { - free(sfamily); return -EINVAL; } - free(sfamily); - a->sockaddr.nl.nl_family = AF_NETLINK; a->sockaddr.nl.nl_groups = group; Index: git/src/cryptsetup-generator.c =================================================================== --- git.orig/src/cryptsetup-generator.c 2011-07-03 08:24:43.892018457 -0700 +++ git/src/cryptsetup-generator.c 2011-07-03 08:25:38.252098188 -0700 @@ -260,7 +260,7 @@ for (;;) { char line[LINE_MAX], *l; - char *name = NULL, *device = NULL, *password = NULL, *options = NULL; + char name[50], device[50], password[50], options[50] = NULL; int k; if (!(fgets(line, sizeof(line), f))) @@ -272,7 +272,7 @@ if (*l == '#' || *l == 0) continue; - if ((k = sscanf(l, "%ms %ms %ms %ms", &name, &device, &password, &options)) < 2 || k > 4) { + if ((k = sscanf(l, "%s %s %s %s", &name, &device, &password, &options)) < 2 || k > 4) { log_error("Failed to parse /etc/crypttab:%u, ignoring.", n); r = EXIT_FAILURE; goto next; @@ -281,11 +281,7 @@ if (create_disk(name, device, password, options) < 0) r = EXIT_FAILURE; - next: - free(name); - free(device); - free(password); - free(options); + next:; } finish: Index: git/src/swap.c =================================================================== --- git.orig/src/swap.c 2011-07-03 08:24:43.892018457 -0700 +++ git/src/swap.c 2011-07-03 08:34:20.512864178 -0700 @@ -1043,11 +1043,12 @@ (void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n"); for (i = 1;; i++) { - char *dev = NULL, *d; + char *d; + char dev[20]; int prio = 0, k; if ((k = fscanf(m->proc_swaps, - "%ms " /* device/file */ + "%19s " /* device/file */ "%*s " /* type of swap */ "%*s " /* swap size */ "%*s " /* used */ @@ -1058,12 +1059,10 @@ break; log_warning("Failed to parse /proc/swaps:%u.", i); - free(dev); continue; } d = cunescape(dev); - free(dev); if (!d) return -ENOMEM; Index: git/src/tmpfiles.c =================================================================== --- git.orig/src/tmpfiles.c 2011-07-03 08:24:43.892018457 -0700 +++ git/src/tmpfiles.c 2011-07-03 08:25:38.272098222 -0700 @@ -66,7 +66,7 @@ typedef struct Item { char type; - char *path; + char path[50]; uid_t uid; gid_t gid; mode_t mode; @@ -619,7 +619,6 @@ static void item_free(Item *i) { assert(i); - free(i->path); free(i); } @@ -654,7 +653,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { Item *i, *existing; - char *mode = NULL, *user = NULL, *group = NULL, *age = NULL; + char mode[50], user[50], group[50], age[50]; Hashmap *h; int r; @@ -669,17 +668,17 @@ if (sscanf(buffer, "%c " - "%ms " - "%ms " - "%ms " - "%ms " - "%ms", + "%s " + "%s " + "%s " + "%s " + "%s", &i->type, &i->path, - &mode, - &user, - &group, - &age) < 2) { + mode, + user, + group, + age) < 2) { log_error("[%s:%u] Syntax error.", fname, line); r = -EIO; goto finish; @@ -793,11 +792,6 @@ r = 0; finish: - free(user); - free(group); - free(mode); - free(age); - if (i) item_free(i); Index: git/src/mount.c =================================================================== --- git.orig/src/mount.c 2011-07-03 08:24:43.892018457 -0700 +++ git/src/mount.c 2011-07-03 08:33:43.112809328 -0700 @@ -24,6 +24,7 @@ #include <mntent.h> #include <sys/epoll.h> #include <signal.h> +#include <string.h> #include "unit.h" #include "mount.h" @@ -1555,7 +1556,13 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) { int r = 0; unsigned i; - char *device, *path, *options, *options2, *fstype, *d, *p, *o; + char *d, *p, *o; + char device[50]; + char path[50]; + char options[50]; + char options2[50]; + char fstype[50]; + assert(m); @@ -1564,26 +1571,26 @@ for (i = 1;; i++) { int k; - device = path = options = options2 = fstype = d = p = o = NULL; + d = p = o = NULL; if ((k = fscanf(m->proc_self_mountinfo, "%*s " /* (1) mount id */ "%*s " /* (2) parent id */ "%*s " /* (3) major:minor */ "%*s " /* (4) root */ - "%ms " /* (5) mount point */ - "%ms" /* (6) mount options */ + "%49s " /* (5) mount point */ + "%49s" /* (6) mount options */ "%*[^-]" /* (7) optional fields */ "- " /* (8) separator */ - "%ms " /* (9) file system type */ - "%ms" /* (10) mount source */ - "%ms" /* (11) mount options 2 */ + "%49s " /* (9) file system type */ + "%49s" /* (10) mount source */ + "%49s" /* (11) mount options 2 */ "%*[^\n]", /* some rubbish at the end */ - &path, - &options, - &fstype, - &device, - &options2)) != 5) { + path, + options, + fstype, + device, + options2)) != 5) { if (k == EOF) break; @@ -1607,22 +1614,12 @@ r = k; clean_up: - free(device); - free(path); - free(options); - free(options2); - free(fstype); free(d); free(p); free(o); } finish: - free(device); - free(path); - free(options); - free(options2); - free(fstype); free(d); free(p); free(o); Index: git/src/umount.c =================================================================== --- git.orig/src/umount.c 2011-07-03 08:24:43.892018457 -0700 +++ git/src/umount.c 2011-07-03 08:33:06.732755969 -0700 @@ -60,7 +60,9 @@ static int mount_points_list_get(MountPoint **head) { FILE *proc_self_mountinfo; - char *path, *p; + char *p; + char path[50]; + unsigned int i; int r; @@ -72,17 +74,17 @@ for (i = 1;; i++) { int k; MountPoint *m; - char *root; + char root[50]; bool skip_ro; - path = p = NULL; + p = NULL; if ((k = fscanf(proc_self_mountinfo, "%*s " /* (1) mount id */ "%*s " /* (2) parent id */ "%*s " /* (3) major:minor */ - "%ms " /* (4) root */ - "%ms " /* (5) mount point */ + "%49s " /* (4) root */ + "%49s " /* (5) mount point */ "%*s" /* (6) mount options */ "%*[^-]" /* (7) optional fields */ "- " /* (8) separator */ @@ -90,24 +92,21 @@ "%*s" /* (10) mount source */ "%*s" /* (11) mount options 2 */ "%*[^\n]", /* some rubbish at the end */ - &root, - &path)) != 2) { + root, + path)) != 2) { if (k == EOF) break; log_warning("Failed to parse /proc/self/mountinfo:%u.", i); - free(path); continue; } /* If we encounter a bind mount, don't try to remount * the source dir too early */ skip_ro = !streq(root, "/"); - free(root); p = cunescape(path); - free(path); if (!p) { r = -ENOMEM; @@ -152,28 +151,28 @@ for (i = 2;; i++) { MountPoint *swap; - char *dev = NULL, *d; + char *d; + char dev[50]; + int k; if ((k = fscanf(proc_swaps, - "%ms " /* device/file */ + "%50s " /* device/file */ "%*s " /* type of swap */ "%*s " /* swap size */ "%*s " /* used */ "%*s\n", /* priority */ - &dev)) != 1) { + dev)) != 1) { if (k == EOF) break; log_warning("Failed to parse /proc/swaps:%u.", i); - free(dev); continue; } if (endswith(dev, "(deleted)")) { - free(dev); continue; }
uclibc does not have mkostemp() so we redefine it to use mkstemp() Signed-off-by: Khem Raj <[email protected]> Index: git/src/macro.h =================================================================== --- git.orig/src/macro.h 2011-06-30 10:33:53.000000000 -0700 +++ git/src/macro.h 2011-06-30 15:07:28.285270006 -0700 @@ -27,6 +27,10 @@ #include <sys/uio.h> #include <inttypes.h> +#ifdef __UCLIBC__ +/* uclibc does not implement mkostemp GNU extention */ +#define mkostemp(x,y) mkstemp(x) +#endif #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b))) #define _sentinel_ __attribute__ ((sentinel)) #define _noreturn_ __attribute__((noreturn))
We get errors like | /bin/mkdir -p man/ && /home/kraj/work/angstrom/build/tmp-angstrom_2010_x-uclibc/sysroots/x86_64-linux/usr/bin/xsltproc -o man/systemd.1 --nonet --param funcsynopsis.style "'ansi'" http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl man/systemd.xml | I/O error : Attempt to load network entity http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl | warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" | cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl | make[1]: *** [man/systemd.1] Error 4 | make[1]: Leaving directory `/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-uclibc/work/armv5teb-angstrom-linux-uclibceabi/systemd-git-r4/git' | make: *** [all] Error 2 | + die 'oe_runmake failed' | + bbfatal 'oe_runmake failed' | + echo 'ERROR: oe_runmake failed' | ERROR: oe_runmake failed | + exit 1 This patch disables --nonet option to xsltproc Signed-off-by: Khem Raj <[email protected]> --- git/Makefile.am.org 2011-06-30 16:07:21.715269183 -0700 +++ git/Makefile.am 2011-06-30 16:07:26.805269182 -0700 @@ -1315,7 +1315,6 @@ endif if HAVE_XSLTPROC XSLTPROC_FLAGS = \ - --nonet \ --param funcsynopsis.style "'ansi'" XSLTPROC_PROCESS_MAN = \
signature.asc
Description: This is a digitally signed message part
_______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
