[LTP] [PATCH v2 1/3] syscalls: refactor fork09 using new API
Cyril Hrubis
chrubis@suse.cz
Thu Mar 5 15:09:14 CET 2026
Hi!
> - * ALGORITHM
> - * Parent opens a maximum number of files
> - * Child closes one and attempts to open another, it should be
> - * available
This is different description than the new one below.
> -#include <sys/types.h>
> -#include <sys/wait.h>
> -#include <sys/stat.h>
> -#include <fcntl.h>
> -#include <stdio.h>
> -#include <errno.h>
> -#include <unistd.h> /* for _SC_OPEN_MAX */
> -#include "test.h"
> -#include "tso_safe_macros.h"
> -
> -char *TCID = "fork09";
> -int TST_TOTAL = 1;
> +/*\
> + * Verify that a forked child can close all the files which have been open by
> + * the parent process.
> + */
Which is a different assertion from what the test did before.
I would keep the code we have after the conversion but we should close a
file in the child and ten open another one before we attemp to close all
the files in the child.
> + tst_res(TINFO, "Opening files from parent");
> +
> + for (nfiles = 0; nfiles < file_open_max; nfiles++) {
> + memset(name, 0, PATH_MAX);
I wonder what is this memset() needed for?
snprintf() always terminates the string
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list