[LTP] [PATCH v3] fcntl40.c: Test fcntl using F_CREATED_QUERY
Cyril Hrubis
chrubis@suse.cz
Wed Apr 2 12:29:43 CEST 2025
Hi!
> +static void verify_fcntl(void)
> +{
> + int fd;
> +
> + fd = SAFE_OPEN("/dev/null", O_RDONLY | O_CLOEXEC);
> +
> + /* We didn't create "/dev/null". */
> + TST_EXP_EQ_LI(fcntl(fd, F_CREATED_QUERY, 0), 0);
> + SAFE_CLOSE(fd);
> +
> + fd = SAFE_OPEN(TEST_NAME, O_CREAT | O_RDONLY | O_CLOEXEC, 0600);
> +
> + TST_EXP_EQ_LI(fcntl(fd, F_CREATED_QUERY, 0), 1);
> + SAFE_CLOSE(fd);
> +
> + fd = SAFE_OPEN(TEST_NAME, O_RDONLY | O_CLOEXEC);
> +
> + /* We're opening it again, so no positive creation check. */
> + TST_EXP_EQ_LI(fcntl(fd, F_CREATED_QUERY, 0), 0);
> + SAFE_CLOSE(fd);
> + SAFE_UNLINK(TEST_NAME);
> +
> + /* tst_res(TPASS, "fcntl F_CREATED_QUERY check pass"); */
Why is this line here? It's not even proper comment, just commented out
code. It should have been removed.
> +}
> +
> +static struct tst_test test = {
> + .test_all = verify_fcntl,
> + .needs_tmpdir = 1,
> + .min_kver = "6.12",
> + .tags = (const struct tst_tag[]) {
> + {"linux-git", "d0fe8920cbe4"},
This points to the kernel commit that added the test. Commit tags are
only for kernel commits that fixed a kernel bug, not for commits where
functionality was added.
> + {}
> + }
> +};
> --
> 2.35.3
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list