[LTP] [PATCH v2] open06.c: convert to new LTP API

Petr Vorel pvorel@suse.cz
Thu Jul 14 15:18:48 CEST 2022


Hi Avinesh,

> -	if (mknod(fname, S_IFIFO | 0644, 0) == -1)
> -		tst_brkm(TBROK, cleanup, "mknod FAILED");
> +	SAFE_MKFIFO(TEMP_FIFO, 0644);
You changed test from mknod() to mkfifo(). May I know why?
It would be worth to mention the reason in the commit message.

Should not we keep mknod() ?
SAFE_MKNOD(TEMP_FIFO, S_IFIFO | 0644, 0);

According to man mknod(2) your change is correct:

       POSIX.1-2001 says: "The only portable use of mknod() is to create
       a FIFO-special file.  If mode is not S_IFIFO or dev is not 0, the
       behavior of mknod() is unspecified."  However, nowadays one
       should never use mknod() for this purpose; one should use
       mkfifo(3), a function especially defined for this purpose.

Also note LTP tests should test even deprecated kernel API, we *might* want to
test both mkfifo() and mknod() via .test_variants. But I'd like to hear the
input of the others, because both glibc and musl use SYS_mknod or SYS_mknodat
for mkfifo() implementation with very thin wrapper, thus not sure if it's worth
to test also mknod().

Kind regards,
Petr


More information about the ltp mailing list