[LTP] [PATCH v2] Rewrite msgstress testing suite

Cyril Hrubis chrubis@suse.cz
Fri May 3 11:18:58 CEST 2024


Hi!
> The variable is inside a shared memory and mmap() doesn't allow to 
> create "volatile void*".

This does not do anything with mmap(), volatile is a hint to a compiler.

The mmap() returns void* pointer because that is the way how to return
pointer of an undefined type in C. The caller then assigns the value to
a pointer of a certain type.

What you need to do is to change the global variable to volatile, which
hints the compiler not to assume that the value does not change when
it's not written to. The only other thing to do is to strip explicitly
volatile when the memory is passed to munmap() because otherwise the
compiler will warn that's it's removed implicitly, so we have to cast it
to (void*) there.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list