From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Cyril Hrubis" <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] lib: tst_kconfig: Add runtime checks
Date: Tue, 24 Mar 2026 08:33:22 +0000 [thread overview]
Message-ID: <69c24c53.050a0220.eec9a.6546@mx.google.com> (raw)
In-Reply-To: <20260205135724.23772-1-chrubis@suse.cz>
Hi!
> diff --git a/lib/tst_ns_checks.h b/lib/tst_ns_checks.h
> new file mode 100644
> index 000000000..743d3d09d
> --- /dev/null
> +++ b/lib/tst_ns_checks.h
> @@ -0,0 +1,32 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2026 Cyril Hrubis <chrubis@suse.cz>
> + */
> +
> +#include <unistd.h>
> +#include <stdbool.h>
> +
> +static inline bool tst_user_ns_enabled(void)
> +{
> + return access("/proc/self/ns/user", F_OK) == 0;
> +}
> +
> +static inline bool tst_net_ns_enabled(void)
> +{
> + return access("/proc/self/ns/net", F_OK) == 0;
> +}
> +
> +static inline bool tst_pid_ns_enabled(void)
> +{
> + return access("/proc/self/ns/pid", F_OK) == 0;
> +}
> +
> +static inline bool tst_mnt_ns_enabled(void)
> +{
> + return access("/proc/self/ns/mnt", F_OK) == 0;
> +}
> +
> +static inline bool tst_ipc_ns_enabled(void)
> +{
> + return access("/proc/self/ns/ipc", F_OK) == 0;
> +}
I know header is used only once in the code, but we are missing header
guards in this file anyway. Otherwise there's a risk to break LTP compiling
if imported twice in the future.
Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-03-24 8:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 13:57 [LTP] [PATCH] lib: tst_kconfig: Add runtime checks Cyril Hrubis
2026-02-05 17:47 ` Petr Vorel
2026-02-06 7:58 ` Li Wang via ltp
2026-02-06 8:23 ` Petr Vorel
2026-02-06 12:23 ` Li Wang via ltp
2026-03-26 14:09 ` Cyril Hrubis
2026-03-26 14:16 ` Cyril Hrubis
2026-03-26 16:39 ` Petr Vorel
2026-02-06 8:23 ` Petr Vorel
2026-02-06 8:33 ` Cyril Hrubis
2026-02-06 9:31 ` Petr Vorel
2026-02-06 9:37 ` Petr Vorel
2026-02-06 9:45 ` Cyril Hrubis
2026-02-06 10:31 ` Petr Vorel
2026-03-26 14:38 ` Cyril Hrubis
2026-03-26 15:44 ` Petr Vorel
2026-03-11 8:59 ` Petr Vorel
2026-03-24 8:33 ` Andrea Cervesato via ltp [this message]
2026-03-26 14:17 ` Cyril Hrubis
-- strict thread matches above, loose matches on Subject: below --
2026-03-26 14:40 Cyril Hrubis
2026-03-26 15:15 ` Petr Vorel
2026-03-27 7:02 ` Li Wang via ltp
2026-03-27 11:06 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69c24c53.050a0220.eec9a.6546@mx.google.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=chrubis@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.