[LTP] [PATCH] posix/conformance/interfaces/sem_timedwait/2-1: add _GNU_SOURCE define
Xinjian Ma (Fujitsu)
maxj.fnst@fujitsu.com
Fri Sep 13 06:07:34 CEST 2024
Hi Cyril
> Hi!
> > To get rid of error "‘MAP_ANONYMOUS’ undeclared (first use in this
> function)"
> > on some systems (Fedora 37, etc).
>
> 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.
How about manually defining MAP_ANONYMOUS like below?
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c
index 2eca8dff6..83d1894ec 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c
@@ -27,6 +27,10 @@
#define FUNCTION "sem_timedwait"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS 0x20
+#endif
+
int main(void)
{
sem_t *mysemp;
> Also MAP_ANONYMOUS is requiered to be there by POSIX so setting
> _GNU_SOURCE does not seem to be a good solution.
I checked the https://sourceware.org/glibc/manual/2.40/html_mono/libc.html#index-MAP_005fANONYMOUS
` MAP_ANONYMOUS ` is showed in GNU document, does this mean it follows the GNU rules?
Best regards
Ma
>
> > Signed-off-by: Ma Xinjian <maxj.fnst@fujitsu.com>
> > ---
> > .../conformance/interfaces/sem_timedwait/2-1.c | 1
> +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git
> > a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/
> > 2-1.c
> > b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/
> > 2-1.c
> > index 2eca8dff6..4ccef7261 100644
> > ---
> > a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/
> > 2-1.c
> > +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedw
> > +++ ait/2-1.c
> > @@ -11,6 +11,7 @@
> > */
> >
> >
> > +#define _GNU_SOURCE
> > #include <stdio.h>
> > #include <errno.h>
> > #include <unistd.h>
> > --
> > 2.42.0
> >
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
>
> --
> Cyril Hrubis
> chrubis@suse.cz
More information about the ltp
mailing list