From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1y38-0002He-1e for qemu-devel@nongnu.org; Thu, 16 Aug 2012 07:15:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1y34-0006Hq-1E for qemu-devel@nongnu.org; Thu, 16 Aug 2012 07:15:37 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:38958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1y33-0006HA-QY for qemu-devel@nongnu.org; Thu, 16 Aug 2012 07:15:33 -0400 From: Peter Maydell Date: Thu, 16 Aug 2012 12:15:18 +0100 Message-Id: <1345115718-4054-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH for-1.2] osdep: Fix compilation failure on BSD systems List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Corey Bryant , patches@linaro.org Fix compilation failure on BSD systems (which don't have O_DIRECT or O_NOATIME: osdep.c:116: error: ‘O_DIRECT’ undeclared (first use in this function) osdep.c:116: error: (Each undeclared identifier is reported only once osdep.c:116: error: for each function it appears in.) osdep.c:116: error: ‘O_NOATIME’ undeclared (first use in this function) Signed-off-by: Peter Maydell --- PS: Do we care about O_DSYNC, O_RSYNC, O_SYNC? POSIX says those can be used via fcntl() too... osdep.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osdep.c b/osdep.c index 5b78cee..3b25297 100644 --- a/osdep.c +++ b/osdep.c @@ -113,7 +113,13 @@ static int qemu_dup_flags(int fd, int flags) } /* Set/unset flags that we can with fcntl */ - setfl_flags = O_APPEND | O_ASYNC | O_DIRECT | O_NOATIME | O_NONBLOCK; + setfl_flags = O_APPEND | O_ASYNC | O_NONBLOCK; +#ifdef O_NOATIME + setfl_flags |= O_NOATIME; +#endif +#ifdef O_DIRECT + setfl_flags |= O_DIRECT; +#endif dup_flags &= ~setfl_flags; dup_flags |= (flags & setfl_flags); if (fcntl(ret, F_SETFL, dup_flags) == -1) { -- 1.7.11.4