Compare commits

..

4 Commits

Author SHA1 Message Date
Daan De Meyer 7b679a188e sd-bus: Cite sd_bus_creds_unref in sd_bus_get_name_creds docs 2020-04-25 10:01:18 +02:00
Dan Streetman af5654d35c test-cgroup: skip if /sys/fs/cgroup unknown fs
It's not always mounted, e.g. during the build-time tests, it's running inside
a chroot (that's how Debian/Ubuntu build packages, in chroots) so this test
always fails because /sys/fs/cgroup isn't mounted.
2020-04-25 10:00:43 +02:00
Dan Streetman 0bc5f001db cgroup-util: check for SYSFS_MAGIC when detecting cgroup format
When nothing at all is mounted at /sys/fs/cgroup, the fs.f_type is
SYSFS_MAGIC (0x62656572) which results in the confusing debug log:

"Unknown filesystem type 62656572 mounted on /sys/fs/cgroup."

Instead, if the f_type is SYSFS_MAGIC, a more accurate message is:

"No filesystem is currently mounted on /sys/fs/cgroup."
2020-04-25 10:00:43 +02:00
Norbert Lange 84cb27086f Improve help for clang-format
The comments lack the most important usecase: fixing up your commits.
2020-04-25 09:39:31 +02:00
4 changed files with 30 additions and 6 deletions

View File

@ -3,10 +3,24 @@
# result MUST NOT be committed indiscriminately, but each automated
# change should be reviewed and only the appropriate ones commited.
#
# To apply the coding style you can run the following command (assuming you
# installed clang-format on your system):
# The easiest way to apply the formatting to your changes ONLY,
# is to use the git-clang-format script (usually installed with clang-format).
#
# - Fixup formatting before committing
# 1. Edit and stage your files.
# 2. Run `git clang-format`.
# 3. Verify + correct + (un)stage changes.
# 4. Commit.
#
# - Fixup formatting after committing
# 1. Commit your changes.
# 2. Run `git clang-format HEAD~` - Refer the commit *before* your changes here.
# 3. Verify + correct changes, `git difftool -d` can help here.
# 4. Stage + commit, potentially with `--amend` (means to fixup the last commit).
#
# To run clang-format on all sourcefiles, use the following line:
# $ git ls-files 'src/*.[ch]' 'src/*.cc' | xargs clang-format -i -style=file
#
# You can find more information on the different config parameters in this file here:
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---

View File

@ -54,7 +54,8 @@
for a list of possible flags. On success, <parameter>creds</parameter> contains a new
<structname>sd_bus_creds</structname> instance with the requested information. Ownership of this instance
belongs to the caller and it should be freed once no longer needed by calling
<function>sd_bus_creds_unref()</function>.</para>
<citerefentry><refentrytitle>sd_bus_creds_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
<para><function>sd_bus_get_owner_creds()</function> queries the credentials of the creator of the given
bus. The <parameter>mask</parameter> and <parameter>creds</parameter> parameters behave the same as in
@ -113,8 +114,8 @@
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_creds_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -2010,6 +2010,9 @@ int cg_unified_cached(bool flush) {
unified_cache = CGROUP_UNIFIED_NONE;
}
}
} else if (F_TYPE_EQUAL(fs.f_type, SYSFS_MAGIC)) {
return log_debug_errno(SYNTHETIC_ERRNO(ENOMEDIUM),
"No filesystem is currently mounted on /sys/fs/cgroup.");
} else
return log_debug_errno(SYNTHETIC_ERRNO(ENOMEDIUM),
"Unknown filesystem type %llx mounted on /sys/fs/cgroup.",

View File

@ -44,6 +44,13 @@ static void test_cg_split_spec(void) {
static void test_cg_create(void) {
log_info("/* %s */", __func__);
int r;
r = cg_unified_cached(false);
if (r < 0) {
log_info_errno(r, "Skipping %s: %m", __func__);
return;
}
_cleanup_free_ char *here = NULL;
assert_se(cg_pid_get_path_shifted(0, NULL, &here) >= 0);
@ -53,7 +60,6 @@ static void test_cg_create(void) {
*test_c = prefix_roota(here, "/test-b/test-c"),
*test_d = prefix_roota(here, "/test-b/test-d");
char *path;
int r;
log_info("Paths for test:\n%s\n%s", test_a, test_b);