From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38939 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ovy0n-0005dP-54 for qemu-devel@nongnu.org; Wed, 15 Sep 2010 15:51:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ovy0f-0000BR-VR for qemu-devel@nongnu.org; Wed, 15 Sep 2010 15:51:20 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:45233) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ovy0f-0000BM-Qk for qemu-devel@nongnu.org; Wed, 15 Sep 2010 15:51:13 -0400 Received: by qwk4 with SMTP id 4so467260qwk.4 for ; Wed, 15 Sep 2010 12:51:13 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <15F942FE-97D7-4747-A80E-219FF54DDB04@web.de> References: <1284574159-892-1-git-send-email-andreas.faerber@web.de> <15F942FE-97D7-4747-A80E-219FF54DDB04@web.de> From: Blue Swirl Date: Wed, 15 Sep 2010 19:50:53 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH v6] Introduce qemu_madvise() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=C3=A4rber?= Cc: Andrea Arcangeli , qemu-devel@nongnu.org, Alexander Graf On Wed, Sep 15, 2010 at 7:35 PM, Andreas F=C3=A4rber 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 =3D -retval or errno =3D 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.