diff mbox series

Define SYS_futex on 32bit arches using 64-bit time_t

Message ID 20201116003345.3261577-1-raj.khem@gmail.com
State Accepted
Headers show
Series Define SYS_futex on 32bit arches using 64-bit time_t | expand

Commit Message

Khem Raj Nov. 16, 2020, 12:33 a.m. UTC
Newer 32bit arches like RISCV32 and ARC are using 64bit time_t
from get go unlike other 32bit architecture therefore aliasing __NR_futex to
__NR_futex_time64 helps avoid the below errors

tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 lib/tst_checkpoint.c                        | 4 ++++
 testcases/kernel/syscalls/clone/clone08.c   | 4 ++++
 testcases/kernel/syscalls/futex/futextest.h | 4 ++++
 3 files changed, 12 insertions(+)

Comments

Petr Vorel Nov. 16, 2020, 7:08 a.m. UTC | #1
Hi Khem,

> Newer 32bit arches like RISCV32 and ARC are using 64bit time_t
> from get go unlike other 32bit architecture therefore aliasing __NR_futex to
> __NR_futex_time64 helps avoid the below errors

> tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'

Thanks for your fix.

I wonder if this could be defined just in include/lapi/futex.h and this:

https://github.com/pevik/ltp/commit/a20107ab47554798e0de0347dd4d7259f01675af

Kind regards,
Petr
Khem Raj Nov. 16, 2020, 4:07 p.m. UTC | #2
On Sun, Nov 15, 2020 at 11:08 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Khem,
>
> > Newer 32bit arches like RISCV32 and ARC are using 64bit time_t
> > from get go unlike other 32bit architecture therefore aliasing
> __NR_futex to
> > __NR_futex_time64 helps avoid the below errors
>
> > tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'
>
> Thanks for your fix.
>
> I wonder if this could be defined just in include/lapi/futex.h and this:
>
>
> https://github.com/pevik/ltp/commit/a20107ab47554798e0de0347dd4d7259f01675af
>

It could be but it did not work everywhere when I tried it I guess this
header has to be included in all needed placed

>
> Kind regards,
> Petr
>
Petr Vorel Nov. 16, 2020, 5:03 p.m. UTC | #3
Hi Khem,

> On Sun, Nov 15, 2020 at 11:08 PM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi Khem,

> > > Newer 32bit arches like RISCV32 and ARC are using 64bit time_t
> > > from get go unlike other 32bit architecture therefore aliasing
> > __NR_futex to
> > > __NR_futex_time64 helps avoid the below errors

> > > tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'

> > Thanks for your fix.

> > I wonder if this could be defined just in include/lapi/futex.h and this:


> > https://github.com/pevik/ltp/commit/a20107ab47554798e0de0347dd4d7259f01675af


> It could be but it did not work everywhere when I tried it I guess this
> header has to be included in all needed placed

Sure, but that's done :)

You put the changes into 3 files:
lib/tst_checkpoint.c
testcases/kernel/syscalls/clone/clone08.c
testcases/kernel/syscalls/futex/futextest.h

Check the affected files:

I put changes into include/lapi/futex.h
and load it in
testcases/kernel/syscalls/clone/clone08.c

The other two (testcases/kernel/syscalls/clone/clone08.c
testcases/kernel/syscalls/futex/futextest.h) already include lapi/futex.h.

Are you sure it's failing when you try my patchset?

Kind regards,
Petr
Khem Raj Nov. 16, 2020, 6:03 p.m. UTC | #4
On Mon, Nov 16, 2020 at 9:03 AM Petr Vorel <petr.vorel@gmail.com> wrote:
>
> Hi Khem,
>
> > On Sun, Nov 15, 2020 at 11:08 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> > > Hi Khem,
>
> > > > Newer 32bit arches like RISCV32 and ARC are using 64bit time_t
> > > > from get go unlike other 32bit architecture therefore aliasing
> > > __NR_futex to
> > > > __NR_futex_time64 helps avoid the below errors
>
> > > > tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'
>
> > > Thanks for your fix.
>
> > > I wonder if this could be defined just in include/lapi/futex.h and this:
>
>
> > > https://github.com/pevik/ltp/commit/a20107ab47554798e0de0347dd4d7259f01675af
>
>
> > It could be but it did not work everywhere when I tried it I guess this
> > header has to be included in all needed placed
>
> Sure, but that's done :)
>
> You put the changes into 3 files:
> lib/tst_checkpoint.c
> testcases/kernel/syscalls/clone/clone08.c
> testcases/kernel/syscalls/futex/futextest.h
>
> Check the affected files:
>
> I put changes into include/lapi/futex.h
> and load it in
> testcases/kernel/syscalls/clone/clone08.c
>
> The other two (testcases/kernel/syscalls/clone/clone08.c
> testcases/kernel/syscalls/futex/futextest.h) already include lapi/futex.h.
>
> Are you sure it's failing when you try my patchset?
>

I tested https://github.com/pevik/ltp/commit/a20107ab47554798e0de0347dd4d7259f01675af
and it works fine. So please use this one.

> Kind regards,
> Petr
Petr Vorel Nov. 16, 2020, 6:19 p.m. UTC | #5
Hi Khem,

...
> I tested https://github.com/pevik/ltp/commit/a20107ab47554798e0de0347dd4d7259f01675af
> and it works fine. So please use this one.

Thanks for a confirmation, merged.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c
index 5e5b11496c..80e82c13f4 100644
--- a/lib/tst_checkpoint.c
+++ b/lib/tst_checkpoint.c
@@ -31,6 +31,10 @@ 
 #include "safe_macros.h"
 #include "lapi/futex.h"
 
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+#define SYS_futex SYS_futex_time64
+#endif
+
 #define DEFAULT_MSEC_TIMEOUT 10000
 
 futex_t *tst_futexes;
diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c
index 8e115b0421..aaaff94aa0 100644
--- a/testcases/kernel/syscalls/clone/clone08.c
+++ b/testcases/kernel/syscalls/clone/clone08.c
@@ -17,6 +17,10 @@ 
 #include "clone_platform.h"
 #include "lapi/syscalls.h"
 
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+#define SYS_futex SYS_futex_time64
+#endif
+
 static pid_t ptid, ctid, tgid;
 static void *child_stack;
 
diff --git a/testcases/kernel/syscalls/futex/futextest.h b/testcases/kernel/syscalls/futex/futextest.h
index c50876fa67..06e2275d55 100644
--- a/testcases/kernel/syscalls/futex/futextest.h
+++ b/testcases/kernel/syscalls/futex/futextest.h
@@ -20,6 +20,10 @@ 
 #include "lapi/futex.h"
 #include "tst_timer.h"
 
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+#define SYS_futex SYS_futex_time64
+#endif
+
 #define FUTEX_INITIALIZER 0
 
 #ifndef FUTEX_CMP_REQUEUE