diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-08-16 12:15:18 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-08-16 13:41:16 -0500 |
commit | d973ba18ced6e9440131c55b0f07e97bdbbc6703 (patch) | |
tree | f7186199b2f26c4ac3fabb33752cef47c2f4a37c | |
parent | 7d76ad4fa4405bb20c35fd24c3c848d2bc48f694 (diff) |
osdep: Fix compilation failure on BSD systems
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)
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | osdep.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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) { |