From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] Rewrite msgstress testing suite
Date: Fri, 3 May 2024 11:18:58 +0200 [thread overview]
Message-ID: <ZjSsAl5GT_mYBhR2@yuki> (raw)
In-Reply-To: <0483d3ef-345b-4825-926c-56d0bc617d82@suse.com>
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2024-05-03 9:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 12:10 [LTP] [PATCH v2] Rewrite msgstress testing suite Andrea Cervesato
2024-05-02 12:34 ` Cyril Hrubis
2024-05-03 9:11 ` Andrea Cervesato via ltp
2024-05-03 9:18 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZjSsAl5GT_mYBhR2@yuki \
--to=chrubis@suse.cz \
--cc=andrea.cervesato@suse.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox