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

Avinesh Kumar akumar@suse.de
Wed Jul 27 09:28:20 CEST 2022


Hi Petr,

On Thursday, July 14, 2022 6:48:48 PM IST Petr Vorel wrote:
> 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().
I changed to SAFE_MKFIFO as it seemed more intuitive in this open() test,
but yes, I should have mentioned it in the commit message.
I have not checked the mkfifo() implementation in libraries, so please
lmk which one to proceed with here, I will send updated version if needed.

> 
> Kind regards,
> Petr
> 

Thanks,
Avinesh





More information about the ltp mailing list