Commit graph

13146 commits

Author SHA1 Message Date
Lennart Poettering c004493cde util-lib: split out IO related calls to io-util.[ch] 2015-10-26 01:24:38 +01:00
Lennart Poettering ae9b44b64c Merge pull request #1674 from evverx/run-fix-couldnot-find-executable
run: fix "couldn't find executable" for the existing executables
2015-10-26 00:41:45 +01:00
Evgeny Vereshchagin 9dae55f4bb run: fix "couldn't find executable" for the existing executables
Fixes: #1672
2015-10-25 18:29:24 +00:00
Hristo Venev b1c5176699 test: "today UTC" is not always "today UTC"
On Oct 25 2015 in EET/EEST there is a UTC+3->UTC+2 transition. This
means that the representation of "today UTC" as local time is ambiguous.
2015-10-25 18:46:20 +02:00
Hristo Venev 078efddd37 basic: use the return value of endswith
It returns the position where the suffix begins, which can be used for
strndup to extract the prefix without calling strlen.
2015-10-25 18:46:20 +02:00
Tom Gundersen 1e23792147 Merge pull request #1668 from ssahani/net1
networkd: fix asserts
2015-10-25 14:35:40 +01:00
Tom Gundersen 7c8871d315 Merge pull request #1654 from poettering/util-lib
Various changes to src/basic/
2015-10-25 14:22:43 +01:00
Lennart Poettering 7c25742896 Merge pull request #1667 from evverx/run-protect-system
systemd-run can launch units with ProtectSystem
2015-10-25 13:56:40 +01:00
Lennart Poettering f00022dd12 util-lib: move formats-util.h from shared/ to basic/
It's only a header file, definining format strings for basic system
types, hence it should be in src/basic/, not src/shared/.
2015-10-25 13:19:18 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Zbigniew Jędrzejewski-Szmek 8e0dfb6b8e Merge pull request #1663 from poettering/journal-compress-fix
journal: fix error handling when compressing journal objects
2015-10-25 00:14:51 -04:00
Susant Sahani c2353b2f2f vxlan: fix assert 2015-10-25 09:31:22 +05:30
Susant Sahani cd946b9c36 veth: fix assert 2015-10-25 09:31:18 +05:30
Susant Sahani 0695cb4572 ipvlan: fix assert 2015-10-25 09:31:14 +05:30
Susant Sahani ae185f4857 bond: fix assert 2015-10-25 09:30:59 +05:30
Susant Sahani 2645f07d81 vlan: fix assert 2015-10-25 09:30:17 +05:30
Evgeny Vereshchagin 5664e6cf46 run: can launch units with ProtectSystem 2015-10-24 22:48:33 +00:00
Lennart Poettering 04c0136989 sd-*.h: clean up exported (or to-be-exported) header files
Exported header files should not include internal headers. Fix that.

Exported header files should not use the bool type. So far we opted to
stick to C89 for exported headers, and hence use "int" for bools in
them. Continue to do so.

Exported header files should have #include lines for everything they use
including inttypes.h and sys/types.h, so that they may be included in
any order.

Exported header files should have C++ guards, hence add them.

Exported header files should not use gcc extensions like #pragma once,
get rid of it.
2015-10-24 23:42:56 +02:00
Lennart Poettering 00229fe48f util: move logind_running() to login-util.[ch] 2015-10-24 23:30:40 +02:00
Evgeny Vereshchagin 115cbf7e20 core: various small fixes to unit-printf
* check memory allocation errors in specifier_cgroup_slice
* %I doesn't fail for non-instantiated units (%i doesn't fail too)
* EOPNOTSUPP for consistency
2015-10-24 21:16:02 +00:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Lennart Poettering 4f5dd3943b util: split out escaping code into escape.[ch]
This really deserves its own file, given how much code this is now.
2015-10-24 23:04:42 +02:00
Lennart Poettering dea7b6b043 util-lib: rework extract_first_word_and_warn() a bit
- Really warn in all error cases, not just some. We need to make sure
  that all errors are logged to not confuse the user.

- Explicitly check for EINVAL error code before claiming anything about
  invalid escapes, could be ENOMEM after all.
2015-10-24 23:03:49 +02:00
Lennart Poettering 84ac7bea36 util: split out extract_first_word() and related calls into extract-word.[ch]
This is quite a lot of code these days, hence move it to its own source
file.
2015-10-24 23:03:49 +02:00
Lennart Poettering 0f03c2a4c0 path-util: unify how we process paths specified on the command line
Let's introduce a common function that makes relative paths absolute and
warns about any errors while doing so.
2015-10-24 23:03:49 +02:00
Lennart Poettering 0f47436510 util-lib: get_current_dir_name() can return errors other than ENOMEM
get_current_dir_name() can return a variety of errors, not just ENOMEM,
hence don't blindly turn its errors to ENOMEM, but return correct errors
in path_make_absolute_cwd().

This trickles down into a couple of other functions, some of which
receive unrelated minor fixes too with this commit.
2015-10-24 23:03:49 +02:00
Lennart Poettering 85eca92e20 path-util: rework find_binary(), fsck_exists() and mkfs_exists()
Modernize the code a bit:

- Get rid of FOREACH_WORD_SEPARATOR() loop in favour of a
  extract_first_word() loop.

- Remove find_binary()'s "local" flag. It's not reasonably possible to
  look for binaries on remote systems, we hence should not pretend we
  could.

- When we cannot find a suitable binary, return the last error returned
  from access() rather than ENOENT unconditionally.

- Rework fsck_exists() and mkfs_exists() to return 1 on success, 0 if
  the implementation is missing and negative on real errors. This is
  more like we do it in other functions.

- Make sure we also detect direct fsck symlinks to "true", rather than
  just absolute ones to /bin/true.
2015-10-24 23:03:49 +02:00
Lennart Poettering 0240c60369 journal: irrelevant coding style fixes 2015-10-24 15:08:15 +02:00
Sangjung Woo 46a01abae9 mount: add new SmackFileSystemRoot= setting for mount unit
This option specifies the label to assign the root of the file system if
it lacks the Smack extended attribute. Note that this option will be
ignored if kernel does not support the Smack feature by runtime
checking.
2015-10-24 20:53:54 +09:00
Lennart Poettering d1afbcd221 journal: fix error handling when compressing journal objects
Let's make sure we handle compression errors properly, and don't
misunderstand an error for success.

Also, let's actually compress things if lz4 is enabled.

Fixes #1662.
2015-10-24 13:19:42 +02:00
Lennart Poettering 48d04f25bf Merge pull request #1657 from phomes/tmpfiles-simplification
tmpfiles: simplify mountpoint detection
2015-10-24 12:17:41 +02:00
Lennart Poettering 63a94c49dd Merge pull request #1659 from vcaputo/journal_verify_envalid
journal: s/Envalid/Invalid/
2015-10-24 11:52:52 +02:00
Vito Caputo 0c4a83a259 journal: s/Envalid/Invalid/ 2015-10-23 16:12:31 -07:00
Thomas Hindoe Paaboel Andersen 2bb158c1ce tmpfiles: simplify mountpoint detection
No functional change. Just a simplification. A || (!A && B) is
the same as A || B

Introduced in 78a92a5a23
2015-10-23 22:35:03 +02:00
Lennart Poettering 931c7feac0 Merge pull request #1653 from keszybz/lz4-compress-time
Limit test-compress-benchmark to approx. 12 s of runtime
2015-10-23 17:42:24 +02:00
Zbigniew Jędrzejewski-Szmek 0036b0bf2d test-compress-benchmark: properly initialize buffer
We were compressing unitialized memory, which should not result in
any problems, but is inelegant.
2015-10-23 09:44:16 -04:00
Zbigniew Jędrzejewski-Szmek c4291c1524 test-compress-benchmark: limit default runtime to 2 seconds per subtest
If both lz4 and xz are enabled, this results in a limit of
2×3×2 s ~= 12 s runtime.

Previous implementation started with really small buffer sizes. When
combined with a short time limit this resulteded in abysmal results for xz.
It seems that the initialization overead is really significant for small
buffers. Since xz will not be used by default anymore, this does not
seem worth fixing. Instead buffer sizes are changed to run a
pseudo-random non-repeating pattern. This should allow reasonable testing
for all buffer sizes. For testing, both runtime and the buffer size seed
can be specified on the command line. Sufficiently large runtime allows
all buffer sizes up to 1MB to be tested.
2015-10-23 09:44:16 -04:00
Lennart Poettering d3aacce707 Merge pull request #1652 from filbranden/extract1
util: Replace state with separate booleans in extract_first_word
2015-10-23 13:46:03 +02:00
Lennart Poettering bab15dad0b Merge pull request #1647 from evverx/use-extract-in-namespace-parsing
core: use extract_first_word for namespace parsing
2015-10-23 13:18:55 +02:00
Lennart Poettering adf717bcfd Merge pull request #1648 from evverx/clarify-journalctl-quiet-option
journalctl: clarify -q option
2015-10-23 12:47:07 +02:00
Daniel Mack 952b4473bc Merge pull request #1641 from poettering/btrfs-quota
btrfs quota beef up and various other unrelated changes
2015-10-23 10:50:53 +02:00
Filipe Brandenburger 4cbf8afa04 util: Replace state with separate booleans in extract_first_word
This simplifies the logic and uniformizes the way single and double
quotes are handled. In the end, the code is about 40 lines shorter.

Tested by running the excellent test cases from test-util. Also
installed the systemd binaries including this patch and booted a
system with it, everything looked normal.
2015-10-22 23:12:31 -07:00
Evgeny Vereshchagin 20d936ba81 journalctl: clarify -q option
-q suppresses info messages too
2015-10-22 23:18:17 +00:00
Evgeny Vereshchagin 727f76d715 core: use extract_first_word for namespace parsing
see https://github.com/systemd/systemd/pull/1632#issuecomment-149903791
We should port this loop over to extract_first_word(), too.
2015-10-22 20:28:28 +00:00
Tom Gundersen cbe91b3cba sd-ndisc: reduce callbacks
Only callback on error when the statemachine is in a truly broken state. This
is now only the case when we fail to rearm a timer.
2015-10-22 17:34:58 +02:00
Tom Gundersen 4e5ca364f4 sd-ndisc: drop sd_ndisc_get_prefixlen()
This is unused, and in the future we will pass prefixes and prefixlengths directly
to the callbacks when needed rather than having to search for them.
2015-10-22 17:19:54 +02:00
Tom Gundersen f46fc04fac sd-ndisc: drop sd_ndisc_prefix_match()
This is no longer used.
2015-10-22 17:19:54 +02:00
Tom Gundersen f6e0ce6660 sd-ndisc: don't trigger timeout on prefix expiry
The caller of the library is no longer notified, so triggering a timer
just to clean up is not necessary. Instead check for and clean up
invalid prefixes lazily.
2015-10-22 17:19:54 +02:00
Tom Gundersen 272f5cd9b7 sd-ndisc: remove a prefix from the ndisc object when freeing it
This follows the coding style, and allows some simplification to the rest of the code.
2015-10-22 17:19:54 +02:00
Tom Gundersen 77b05fa9a7 sd-ndisc: don't inform the caller of expired prefixes
The caller should push any lifetime information into the kernel and let the kernel handle
prefix expiration.
2015-10-22 17:19:54 +02:00