On Wed, Sep 15, 2010 at 7:35 PM, Andreas Färber <andreas.faer...@web.de> wrote: > Am 15.09.2010 um 21:00 schrieb Blue Swirl: > >> madvise() actually >> returns 0 or -1 with error code in errno. Should we try to match that? > > posix_madvise() doesn't seem to... "otherwise, an error number shall be > returned to indicate the error"
If we match posix_madvise(), then the wrapper function probably should become qemu_posix_madvise() and we should prefer posix_madvise() over madvise(). > It documents EINVAL for invalid advice, and so does madvise. Are we using > ENOTSUP knowingly? Let's use EINVAL. > Maybe return -1 and set errno to the posix_madvise() return code? (but is it > errno = -retval or errno = retval then?) An advantage of posix_madvise() semantics is that no mucking with errno is needed. Though existing code should be checked if they rely on madvise() semantics instead.