On Tue, 15 Mar 2022 18:33:33 +0000 Peter Maydell <peter.mayd...@linaro.org> wrote:
> Since this is a little bit tricky, I think a comment here will help > future readers: > > # Older Solaris/Illumos provide madvise() but forget to prototype it. I don't think it matters much, but just to mention, the prototype is in there, but it's deliberately hidden by some #ifdef logic for (older?) POSIX/XPG compliance or something. I sometimes try to phrase this in a way that reflects that, but it's hard so I probably won't care. > > +#ifdef HAVE_MADVISE_MISSING_PROTOTYPE > > /* See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for > > discussion about Solaris header problems */ > > extern int madvise(char *, size_t, int); > > #endif > > As you note, this doesn't match the name we picked in meson.build. > I don't feel very strongly about the name (we certainly don't manage > consistency across the project about CONFIG_ vs HAVE_ !), but my suggestion > is HAVE_MADVISE_WITHOUT_PROTOTYPE. > > Can you put the prototype in include/qemu/osdep.h, please? > (Exact location not very important as long as it's inside > the extern-C block, but I suggest just under the bit where we > define SIGIO for __HAIKU__.) Okay, but this will cause callers that call madvise() directly to "work", even though they're not going through the qemu_madvise wrapper. There's one area in cross-platform code you noted before, in softmmu/physmem.c, and that does cause the same build error if the prototype is missing. (I'm going to add another commit to make that use the wrapper in the next patchset.) I assume that's not a concern unless I hear otherwise; just pointing it out. And all other comments will be addressed; thanks. -- Andrew Deason adea...@sinenomine.net