[LTP] [PATCH] posix/conformance/interfaces/sem_timedwait/2-1: add _GNU_SOURCE define
Xinjian Ma (Fujitsu)
maxj.fnst@fujitsu.com
Thu Sep 19 05:38:48 CEST 2024
Hi Cyril
> -----Original Message-----
> From: Cyril Hrubis <chrubis@suse.cz>
> Sent: 2024年9月17日 22:17
> To: Ma, Xinjian/马 新建 <maxj.fnst@fujitsu.com>
> Cc: ltp@lists.linux.it
> Subject: Re: [LTP] [PATCH] posix/conformance/interfaces/sem_timedwait/2-1:
> add _GNU_SOURCE define
>
> Hi!
> > > That does not sound right, the open posix testsuite must not depend
> > > on anything GNU specific.
> >
> > I see. Thanks.
> > But I tested both on Fedora and Ubuntu, they reported the same error
> > if using the params " -std=c99 -D_POSIX_C_SOURCE=200809L
> > -D_XOPEN_SOURCE=700" for gcc.
>
> That is certainly unexpected. I managed to reproduce this on Debian 12.
>
> Looks that on certain systems the MMAP_ANONYMOUS seems to be guarded
> by __USE_MISC. The __USE_MISC is defined in /usr/include/features.h and set if
> _DEFAULT_SOURCE is set which is set by _GNU_SOURCE.
>
> I did double check the POSIX and I was probably confusing MAP_PRIVATE and
> MAP_ANONYMOUS, sorry. Looks like MAP_ANONYMOUS is indeed not a part of
> POSIX.
>
> > How about manually defining MAP_ANONYMOUS like below?
>
> Does not seem to be a good solution either, that will work only on Linux. The
> open posix testsuite is supposed to run on any POSIX compatible OS.
>
> I'm afraid that the only solution we can use is to allocate the shared memory via
> the posix shm. That means to get the file descriptor for
> mmap() from shm_open() (followed by shm_unlink()).
Thank you for the suggestion. I sent a new patch, PTAL.
https://lore.kernel.org/ltp/20240919032729.458711-1-maxj.fnst@fujitsu.com/T/#u
Best regards,
Ma
>
> --
> Cyril Hrubis
> chrubis@suse.cz
More information about the ltp
mailing list