summaryrefslogtreecommitdiff
path: root/src/basic
Commit message (Collapse)AuthorAge
* basic: define HEXDIGITSDaniel Kahn Gillmor2017-06-16
| | | | | define HEXDIGITS alongside DIGITS, and use it where it's already useful. We'll use it again shortly when parsing MAC addresses.
* missing.h: add BTRFS_IOC_QUOTA_RESCAN_WAIT (#3266)Stefan Saraev2017-06-16
|
* locale-util: mark special_glyph() as _const_Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | _const_ means that the caller can assume that the function will return the same result every time (and will not modify global memory). special_glyph() meets this: even though it depends on global memory, that part of global memory is not expected to change. This allows the calls to special_glyph() to be optimized, even if -flto is not used.
* tree-wide: rename draw_special_char to special_glyphZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | That function doesn't draw anything on it's own, just returns a string, which sometimes is more than one character. Also remove "DRAW_" prefix from character names, TREE_* and ARROW and BLACK_CIRCLE are unambigous on their own, don't draw anything, and are always used as an argument to special_glyph(). Rename "DASH" to "MDASH", as there's more than one type of dash.
* core: rework how we flush incoming traffic when a socket unit goes downLennart Poettering2017-06-16
| | | | | | | | | Previously, we'd simply close and reopen the socket file descriptors. This is problematic however, as we won't transition through the SOCKET_CHOWN state then, and thus the file ownership won't be correct for the sockets. Rework the flushing logic, and actually read any queued data from the sockets for flushing, and accept any queued messages and disconnect them.
* tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhereLennart Poettering2017-06-16
| | | | | | | | | | The macro determines the right length of a AF_UNIX "struct sockaddr_un" to pass to connect() or bind(). It automatically figures out if the socket refers to an abstract namespace socket, or a socket in the file system, and properly handles the full length of the path field. This macro is not only safer, but also simpler to use, than the usual offsetof() + strlen() logic.
* machined: support non-btrfs file systems with "machinectl clone"Lennart Poettering2017-06-16
| | | | | | | | Fall back to a normal copy operation when the backing file system isn't btrfs, and hence doesn't support cheap snapshotting. Of course, this will be slow, but given that the execution is asynchronous now, this should be OK. Fixes: #1308
* copy: adjust directory times after writing to the directoryLennart Poettering2017-06-16
| | | | | | When recursively copying a directory tree, fix up the file times after having created all contents in it, so that our changes don't end up altering any of the directory times.
* copy: return the right error when we can't open a fileLennart Poettering2017-06-16
|
* copy: also copy AF_UNIX socketsLennart Poettering2017-06-16
| | | | | | | | We previously would fail with EOPNOTSUPP when encountering an AF_UNIX socket in the directory tree to copy. Fix that, and copy them too (even if they are dead in the result). Fixes: #2914
* parse-util: fix conversion from size_t on s390 (#3147)Lubomir Rintel2017-06-16
| | | | | | | | On s390 size_t is an unsigned long, nor an unsigned int. They both are of the same size and can be cast to each other safely, but the compiler still seems unhappy about incompatible pointers. Fixes: 7c2da2ca8
* basic/mount-util: recognize pvfs2 as network fs (#3140)Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | Added to kernel 4.6.
* tree-wide: rename hidden_file to hidden_or_backup_file and optimizeZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | In standard linux parlance, "hidden" usually means that the file name starts with ".", and nothing else. Rename the function to convey what the function does better to casual readers. Stop exposing hidden_file_allow_backup which is rather ugly and rewrite hidden_file to extract the suffix first. Note that hidden_file_allow_backup excluded files with "~" at the end, which is quite confusing. Let's get rid of it before it gets used in the wrong place.
* basic/dirent-util: do not call hidden_file_allow_backup from ↵Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | dirent_is_file_with_suffix If the file name is supposed to end in a suffix, there's not need to check the name against a list of "special" file names, which is slow. Instead, just check that the name doens't start with a period.
* path-util: Add hidden suffixes for ucf (#3131)Martin Pitt2017-06-16
| | | | | | | | | ucf is a standard Debian helper for managing configuration file upgrades which need more interaction or elaborate merging than conffiles managed by dpkg. Ignore its temporary and backup files similarly to the *.dpkg-* ones to avoid creating units for them in generators. https://bugs.debian.org/775903
* build-sys: improve compat with older kernel headersLennart Poettering2017-06-16
| | | | | | | | In 4.2 kernel headers, some netlink defines are missing that we need. missing.h already can add them in, but currently makes this dependent on a definition that these kernels already have. Change the check hence to check for the newest definition in the table, so that the whole bunch of definitions as added in on all kernels lacking this.
* nspawn: don't try to patch UIDs/GIDs of procfs and suchlikeLennart Poettering2017-06-16
|
* nspawn: make -U a tiny bit smarterLennart Poettering2017-06-16
| | | | | With this change -U will turn on user namespacing only if the kernel actually supports it and otherwise gracefully degrade to non-userns mode.
* networkd: bump MTU to 1280 for interfaces which have IPv6 enabled (#3077)Susant Sahani2017-06-16
| | | | | | | | | | | | IPv6 protocol requires a minimum MTU of 1280 bytes on the interface. This fixes #3046. Introduce helper link_ipv6_enabled() to figure out whether IPV6 is enabled. Introduce network_has_static_ipv6_addresses() to find out if any static ipv6 address configured. If IPv6 is not configured on any interface that is SLAAC, DHCPv6 and static IPv6 addresses not configured, then IPv6 will be automatically disabled for that interface, that is we write "1" to /proc/sys/net/ipv6/conf//disable_ipv6.
* tree-wide: don't assume CLOCK_BOOTIME is generally availableLennart Poettering2017-06-16
| | | | | | | | | | | | Before we invoke now(CLOCK_BOOTTIME), let's make sure we actually have that clock, since now() will otherwise hit an assert. Specifically, let's refuse CLOCK_BOOTTIME early in sd-event if the kernel doesn't actually support it. This is a follow-up for #3037, and specifically: https://github.com/elogind/elogind/pull/3037#issuecomment-210199167
* core,systemctl: add bus API to retrieve processes of a unitLennart Poettering2017-06-16
| | | | | | | | | | | | | | | This adds a new GetProcesses() bus call to the Unit object which returns an array consisting of all PIDs, their process names, as well as their full cgroup paths. This is then used by "systemctl status" to show the per-unit process tree. This has the benefit that the client-side no longer needs to access the cgroupfs directly to show the process tree of a unit. Instead, it now uses this new API, which means it also works if -H or -M are used correctly, as the information from the specific host is used, and not the one from the local system. Fixes: #2945
* basic: user-utils.c needs missing.h for secure_getenv (#3059)michaelolbrich2017-06-16
| | | | | | | Otherwise building may fail with: src/basic/user-util.c: In function 'get_home_dir': src/basic/user-util.c:343:9: error: implicit declaration of function 'secure_getenv' [-Werror=implicit-function-declaration]
* networkd: allow setting of multicast querier for linux bridge (#3051)Susant Sahani2017-06-16
|
* tree-wide: introduce PATH_IN_SET macroZbigniew Jędrzejewski-Szmek2017-06-16
|
* basic/util: check return value of dup2 in fork_agent()Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | CID #1304689.
* tests: override XDG_RUNTIME_DIR where we use the user runtime dirLennart Poettering2017-06-16
| | | | | | | We don#t really support systems where XDG_RUNTIME_DIR is not supported for elogind --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that involve elogind --user, so that we know it is set, and that it doesn't polute the user's actual runtime dir.
* tree-wide: add new SIGNAL_VALID() macro-like function that validates signal ↵Lennart Poettering2017-06-16
| | | | | | numbers And port all code over to use it.
* core: be more paranoid when mixing umask and fopen()Lennart Poettering2017-06-16
| | | | | Let's be extra careful with the umask when we use simple fopen(), as this creates files with 0777 by default.
* core: rework how transient unit files and property drop-ins workLennart Poettering2017-06-16
| | | | | | | | | | | | | | | With this change the logic for placing transient unit files and drop-ins generated via "systemctl set-property" is reworked. The latter are now placed in the newly introduced "control" unit file directory. The fomer are now placed in the "transient" unit file directory. Note that the properties originally set when a transient unit was created will be written to and stay in the transient unit file directory, while later changes are done via drop-ins. This is preparation for a later "systemctl revert" addition, where existing drop-ins are flushed out, but the original transient definition is restored.
* basic: fallback to fstatat if entry->d_type is DT_UNKNOWNEvgeny Vereshchagin2017-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | * tests-functions: improve FSTYPE-support make clean setup FSTYPE=reiserfs is working fine now :) * basic: fallback to fstatat if entry->d_type is DT_UNKNOWN Fixes localectl on reiserfs: -bash-4.3# mkdir -p /usr/lib/locale -bash-4.3# stat -f /usr/lib/locale/ File: "/usr/lib/locale/" ID: bdb0322715b5366e Namelen: 255 Type: reiserfs Block size: 4096 Blocks: Total: 99835 Free: 60262 Available: 60262 Inodes: Total: 0 Free: 0 -bash-4.3# mkdir /usr/lib/locale/HeyHo -bash-4.3# localectl list-locales --no-pager -bash-4.3# mount -t tmpfs tmpfs /usr/lib/locale -bash-4.3# mkdir /usr/lib/locale/HeyHo -bash-4.3# localectl list-locales --no-pager HeyHo
* test-compress-benchmark: fix argument parsing on 32bitZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | The patch is not minimal, but a function to parse size_t is probably going to come in handy in other places, so I think it's nicer to define a proper parsing function than to open-code the cast.
* core: update populated event handling in unified hierarchyTejun Heo2017-06-16
| | | | | | | Earlier during the development of unified hierarchy, the populated event was reported through by the dedicated "cgroup.populated" file; however, the interface was updated so that it's reported through the "populated" field of "cgroup.events" file. Update populated event handling logic accordingly.
* Ignore BOM in config filesZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | Fixes #2823. Also remove unnecessary feof check.
* basic/missing: move syscall definitions to basic/missing_syscall.hZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | | | | | | We have a bunch of syscall wrapper definitions and it's easier to see that they follow the same pattern if they are not interspersed with other defines. Change the wrappers to be uniform: - if __NR_XXX is not defined, do not bother to call the syscall, and return -1/ENOSYS immediately. - do not check __NR_XXX defines if we detect the symbol as defined, since we don't need them anyway - reindent stuff for readability New file basic/missing_syscall.h is included at the end of missing.h because it might make use of some of the definitions in missing.h.
* basic/log: remove unused return valueZbigniew Jędrzejewski-Szmek2017-06-16
|
* basic/macros: clang 3.5 doesn't support alloc_sizeZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | The attribute was removed in commit c047507 in the clang repository as it was never properly implemented anyway. Avoid using the attribute with clang because it generates a ton of annoying warnings.
* basic/missing: add copy_file_rangeZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | syscall numbers based on: https://fedora.juszkiewicz.com.pl/syscalls.html
* include sys/sysmacros.h in more placesMike Frysinger2017-06-16
| | | | | | Since glibc is moving away from implicitly including sys/sysmacros.h all the time via sys/types.h, include the header directly in more places. This seems to cover most makedev/major/minor usage.
* string-table: split long definitionsZbigniew Jędrzejewski-Szmek2017-06-16
|
* tree-wide: no need to pass excess flags to open()/openat() if O_PATH is passedAlexander Kuleshov2017-06-16
| | | | | | | | | | As described in the documentation: When O_PATH is specified in flags, flag bits other than O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW are ignored. So, we can remove unnecessary flags in a case when O_PATH is passed to the open() or openat().
* Redefine 32bit time_t format to signedZbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | | | It seems that it is signed both on i386 and arm. Avoids a stupid gcc warning on arm: src/udev/udevadm-monitor.c: In function ‘print_device’: src/udev/udevadm-monitor.c:44:16: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘__time_t {aka long int}’ [-Wformat=] printf("%-6s[%"PRI_TIME".%06ld] %-8s %s (%s)\n", ^
* core: avoid compiler warning when compiling with -fexceptionsThomas Haller2017-06-16
| | | | | | | Initialize auto variables with cleanup attribute, otherwise we get a compiler warning with -fexceptions. ./configure CFLAGS='-Wmaybe-uninitialized -fexceptions -O2'
* basic: mark unused variable as suchThomas Hindoe Paaboel Andersen2017-06-16
|
* tree-wide: minor formatting inconsistency cleanupsVito Caputo2017-06-16
|
* tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2017-06-16
| | | | | | Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
* resolved: fix notification iteration logic when transactions are completedLennart Poettering2017-06-16
| | | | | | | | | | | | | | | | | | When a transaction is complete, and we notify its owners, make sure we deal correctly with the requesters removing themselves from the list of owners while we continue iterating. This was previously already dealt with with transactions that require other transactions for DNSSEC purposes, fix this for other possibly transaction owners too now. Since iterating through "Set" objects is not safe regarding removal of entries from it, rework the logic to use two Sets, and move each entry we notified from one set to the other set before we dispatch the notification. This move operation requires no additional memory, and enables us to ensure that we don't notify any object twice. Fixes: #2676
* hashmap: use void* and uint8_t* for generic pointersLennart Poettering2017-06-16
| | | | | | As suggested by CODING_STYLE we should use "void*" as type for generic memory, and uint8_t* for generic bytes. Hence use that instead of "char*", which should really be used only for strings these days.
* util-lib: simplify personality() string matchingLennart Poettering2017-06-16
|
* util-lib: support various ppc archs in personality logicLennart Poettering2017-06-16
|
* util-lib: use the architecture ids from architecture.h for personalitiesLennart Poettering2017-06-16
| | | | We have this ids, hence let's use them universally.