summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2014-07-18Be more verbose when bind or listen failsZbigniew Jędrzejewski-Szmek
Also be more verbose in devnode_acl_all().
2014-07-18barrier: initalize file descriptors with -1Zbigniew Jędrzejewski-Szmek
Explicitly initalize descriptors using explicit assignment like bus_error. This makes barriers follow the same conventions as everything else and makes things a bit simpler too. Rename barier_init to barier_create so it is obvious that it is not about initialization. Remove some parens, etc.
2014-07-18in-addr-util: remove family_to_string() APILennart Poettering
we already have a more complete one with af_to_name(), that is generated from the header files, no need to duplicate this.
2014-07-18change type for address family to "int"Lennart Poettering
Let's settle on a single type for all address family values, even if UNIX is very inconsitent on the precise type otherwise. Given that socket() is the primary entrypoint for the sockets API, and that uses "int", and "int" is relatively simple and generic, we settle on "int" for this.
2014-07-18systemd-detect-virt: detect s390 virtualizationThomas Blume
A system that is running on a logical partition (LPAR) provided by PR/SM has access to physical hardware (except CPU). It is true that PR/SM abstracts the hardware, but only for sharing purposes. Details are statet at: http://publib.boulder.ibm.com/infocenter/eserver/v1r2/topic/eicaz/eicazzlpar.htm -->-- In other words, PR/SM transforms physical resources into virtual resources so that many logical partitions can share the same physical resources. --<-- Still, from the OS point of view, the shared virtual resource is real hardware. ConditionVirtualization must be set to false if the OS runs directly on PR/SM (e.g. in an LPAR). [zj: reorder code so that variables are not allocated when #if-def is false. Add commit message.]
2014-07-18resolved: add LLMNR support for looking up namesLennart Poettering
2014-07-18shared: rename PROTO_ADDRESS_SIZE() to FAMILY_ADDRESS_SIZE()Lennart Poettering
We mostly use "family" to refer to AF_INET, AF_INET6, etc, let's use this terminology here, too
2014-07-17nss-util: be a tiny bit more compatible with glibc's lookup behaviour ↵Lennart Poettering
regarding IPv6 Check for RES_USE_INET6 before we prefer IPv6 over IPv4, for all our NSS modules. (Not that the DNS resolver that is configured with this matters to us, but hey, let's try to be compatible).
2014-07-17detect-virt: Fix Xen domU discoveryThomas Blume
The conditional for detection xen virtualization contained a little mistake. It is checking for i to be empty: 'if (!i) {', but it must check for cap instead, because: 'cap = strsep(&i, ",")' will set cap to the discovered value and i to the next value after the separator. Hence, i would be empty, if there is only control_d in domcap, leading to a wrong domU detection. https://bugs.freedesktop.org/show_bug.cgi?id=77271
2014-07-17shared: add PTY helperDavid Herrmann
This Pty API wraps the ugliness that is POSIX PTY. It takes care of: - edge-triggered HUP handling (avoid heavy CPU-usage on vhangup) - HUP vs. input-queue draining (handle HUP _after_ draining the whole input queue) - SIGCHLD vs. HUP (HUP is no reliable way to catch PTY deaths, always use SIGCHLD. Otherwise, vhangup() and friends will break.) - Output queue buffering (async EPOLLOUT handling) - synchronous setup (via Barrier API) At the same time, the PTY API does not execve(). It simply fork()s and leaves everything else to the caller. Usually, they execve() but we support other setups, too. This will be needed by multiple UI binaries (systemd-console, systemd-er, ...) so it's placed in src/shared/. It's not strictly related to libsystemd-terminal, so it's not included there.
2014-07-17nspawn: use Barrier API instead of eventfd-utilDavid Herrmann
The Barrier-API simplifies cross-fork() synchronization a lot. Replace the hard-coded eventfd-util implementation and drop it. Compared to the old API, Barriers also handle exit() of the remote side as abortion. This way, segfaults will not cause the parent to deadlock. EINTR handling is currently ignored for any barrier-waits. This can easily be added, but it isn't needed so far so I dropped it. EINTR handling in general is ugly, anyway. You need to deal with pselect/ppoll/... variants and make sure not to unblock signals at the wrong times. So genrally, there's little use in adding it.
2014-07-17shared: add generic IPC barrierDavid Herrmann
The "Barrier" object is a simple inter-process barrier implementation. It allows placing synchronization points and waiting for the other side to reach it. Additionally, it has an abortion-mechanism as second-layer synchronization to send abortion-events asynchronously to the other side. The API is usually used to synchronize processes during fork(). However, it can be extended to pass state through execve() so you could synchronize beyond execve(). Usually, it's used like this (error-handling replaced by assert() for simplicity): Barrier b; r = barrier_init(&b); assert_se(r >= 0); pid = fork(); assert_se(pid >= 0); if (pid == 0) { barrier_set_role(&b, BARRIER_CHILD); ...do child post-setup... if (CHILD_SETUP_FAILED) exit(1); ...child setup done... barrier_place(&b); if (!barrier_sync(&b)) { /* parent setup failed */ exit(1); } barrier_destroy(&b); /* redundant as execve() and exit() imply this */ /* parent & child setup successful */ execve(...); } barrier_set_role(&b, BARRIER_PARENT); ...do parent post-setup... if (PARENT_SETUP_FAILED) { barrier_abort(&b); /* send abortion event */ barrier_wait_abortion(&b); /* wait for child to abort (exit() implies abortion) */ barrier_destroy(&b); ...bail out... } ...parent setup done... barrier_place(&b); if (!barrier_sync(&b)) { ...child setup failed... ; barrier_destroy(&b); ...bail out... } barrier_destroy(&b); ...child setup successfull... This is the most basic API. Using barrier_place() to place barriers and barrier_sync() to perform a full synchronization between both processes. barrier_abort() places an abortion barrier which superceeds any other barriers, exit() (or barrier_destroy()) places an abortion-barrier that queues behind existing barriers (thus *not* replacing existing barriers unlike barrier_abort()). This example uses hard-synchronization with wait_abortion(), sync() and friends. These are all optional. Barriers are highly dynamic and can be used for one-way synchronization or even no synchronization at all (postponing it for later). The sync() call performs a full two-way synchronization. The API is documented and should be fairly self-explanatory. A test-suite shows some special semantics regarding abortion, wait_next() and exit(). Internally, barriers use two eventfds and a pipe. The pipe is used to detect exit()s of the remote side as eventfds do not allow that. The eventfds are used to place barriers, one for each side. Barriers itself are numbered, but the numbers are reused once both sides reached the same barrier, thus you cannot address barriers by the index. Moreover, the numbering is implicit and we only store a counter. This makes the implementation itself very lightweight, which is probably negligible considering that we need 3 FDs for a barrier.. Last but not least: This barrier implementation is quite heavy. It's definitely not meant for fast IPC synchronization. However, it's very easy to use. And given the *HUGE* overhead of fork(), the barrier-overhead should be negligible.
2014-07-16test-tables: add new entriesZbigniew Jędrzejewski-Szmek
One missing string found. A few things had to be moved around to make it possible to test them.
2014-07-16Be more careful when checking for empty filesZbigniew Jędrzejewski-Szmek
If we want to avoid reading a totally empty file, it seems better to check after we have opened the file, not before.
2014-07-16Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek
Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
2014-07-16resolved: add CNAME lookup supportLennart Poettering
2014-07-16missing.h: add IFLA_MACVLAN_FLAGSZbigniew Jędrzejewski-Szmek
Now we are getting into kernel < 3.4 territory... https://bugs.freedesktop.org/show_bug.cgi?id=80095
2014-07-16resolved: support for TCP DNS queriesLennart Poettering
2014-07-16shared: include stdbool.h in mkdir.hSjoerd Simons
2014-07-15Constify ConfigTableItem tablesZbigniew Jędrzejewski-Szmek
2014-07-15shared/socket-label: fix error messageZbigniew Jędrzejewski-Szmek
Was: Failed to listen on [::]:2000: Success
2014-07-15shared/socket-util: add function to query remote addressZbigniew Jędrzejewski-Szmek
2014-07-16resolve: add distinct bus error code for hosts that exist but lack A or AAAA ↵Lennart Poettering
records
2014-07-16resolved: add a DNS client stub resolverLennart Poettering
Let's turn resolved into a something truly useful: a fully asynchronous DNS stub resolver that subscribes to network changes. (More to come: caching, LLMNR, mDNS/DNS-SD, DNSSEC, IDN, NSS module)
2014-07-13fileio: quote more shell characters in envfilesMantas Mikulėnas
Turns out, making strings shell-proof is harder than expected: # machinectl set-hostname "foo|poweroff" && . /etc/machine-info (This could be simplified by quoting *and* escaping all characters, which is harmless in shell but unnecessary.)
2014-07-13path-lookup: don't make ~/.local/share/systemd/user a symlinkTanu Kaskinen
We already encourage upstreams to keep the default configuration separate from user customizations for software that is installed in the system location. Let's allow that separation also for software that is installed in the home directory. Some discussion: http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/19627
2014-07-13Add function to open temp files in selinux modeZbigniew Jędrzejewski-Szmek
2014-07-11shared: fix coding-style for ring-buffer implementationDavid Herrmann
We use "typedef struct Ring Ring" with camel-case for internal objects. So rename "struct ring" to "Ring".
2014-07-11shared: add MIN3 macroDavid Herrmann
This is like MIN but evaluates 3 arguments. We already have MAX3, so add the equivalent for MIN.
2014-07-11endian: explicitly include endian.h wherever we want to use __BYTE_ORDERLennart Poettering
2014-07-11always check for __BYTE_ORDER == __BIG_ENDIAN when checking for endianessLennart Poettering
Let's always stick to glibc's way to determine byte order, and not mix autoconf-specific checks with gcc checks.
2014-07-11util: fix has cc check and add testZbigniew Jędrzejewski-Szmek
2014-07-10nss-myhostname: move NSS boilerplate to nss-util.hLennart Poettering
2014-07-10shared: split out in_addr related calls from socket-util.[ch] into its ↵Lennart Poettering
private in-addr-util.[ch] These are enough calls for a new file, and they are sufficiently different from the sockaddr-related calls, hence let's split this out.
2014-07-10nss-myhostname: move local address listing logic into shared, so that we can ↵Lennart Poettering
make use of it from machined
2014-07-07Fix typoZbigniew Jędrzejewski-Szmek
2014-07-07shared: fix format string for usec_t typeLennart Poettering
2014-07-07dropin: add format attribute and fix a wrong callerThomas Hindoe Paaboel Andersen
2014-07-07fstab-generator: add comma when removed option is in the middleZbigniew Jędrzejewski-Szmek
xxx,x-systemd.default-timeout=y,zzz was filtered to xxxzzz, but should be xxx,zzz, of course.
2014-07-07firstboot: get rid of firstboot generator again, introduce ↵Lennart Poettering
ConditionFirstBoot= instead As Zbigniew pointed out a new ConditionFirstBoot= appears like the nicer way to hook in systemd-firstboot.service on first boots (those with /etc unpopulated), so let's do this, and get rid of the generator again.
2014-07-07firstboot: follow lock protocol when changing /etc/shadowLennart Poettering
2014-07-07base-filesystem.c: terminate string array elements with \0Harald Hoyer
NULSTR_FOREACH() looks for a terminating zero and the element also needs one.
2014-07-07firstboot: add new component to query basic system settings on first boot, ↵Lennart Poettering
or when creating OS images offline A new tool "systemd-firstboot" can be used either interactively on boot, where it will query basic locale, timezone, hostname, root password information and set it. Or it can be used non-interactively from the command line when prepareing disk images for booting. When used non-inertactively the tool can either copy settings from the host, or take settings on the command line. $ systemd-firstboot --root=/path/to/my/new/root --copy-locale --copy-root-password --hostname=waldi The tool will be automatically invoked (interactively) now on first boot if /etc is found unpopulated. This also creates the infrastructure for generators to be notified via an environment variable whether they are running on the first boot, or not.
2014-07-07architecture: add string table entries for mips-le archs which were missingLennart Poettering
2014-07-07fileio: simplify write_env_file()Lennart Poettering
2014-07-07util: don't consider tabs special in string_has_cc() anymoreLennart Poettering
Instead, take a list of exceptions to our usual CC check
2014-07-07shared: make timezone and locale enumeration and validation genericLennart Poettering
This way we can reuse it other code thatn just localectl/localed + timedatectl/timedated.
2014-07-07util: consider 0x7F a control chracter (which it is: DEL)Lennart Poettering
Let's better be safe than sorry.
2014-07-03architecture: remove "cris" from uname listLennart Poettering
the only correct name appears to be "crisv32"... http://lists.freedesktop.org/archives/systemd-devel/2014-July/020899.html
2014-07-03machinectl: show /etc/os-release information of container in status outputLennart Poettering