From f97742d0d36810ea72a2bd40b3abb890589ea3b8 Mon Sep 17 00:00:00 2001 From: Alexandre Raymond Date: Mon, 6 Jun 2011 23:34:10 -0400 Subject: Darwin: Fix compilation warning regarding the deprecated daemon() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes since v1: create a wrapper function named qemu_daemon() in oslib-posix.c instead of putting the OS specific workaround in qemu-nbd.c directly. On OSX >= 10.5, daemon() is deprecated, resulting in the following warning: ----8<---- qemu-nbd.c: In function ‘main’: qemu-nbd.c:371: warning: ‘daemon’ is deprecated (declared at /usr/include/stdlib.h:289) ----8<---- The following trick, used in mDNSResponder, takes care of this warning: http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-258.18/mDNSPosix/PosixDaemon.c On OSX, it temporarily renames the daemon() function before including stdlib.h and declares it manually as an extern function. This way, the compiler does not see the declaration from stdlib.h and thus does not display the warning. Signed-off-by: Alexandre Raymond Cc: Blue Swirl Signed-off-by: Andreas Färber --- osdep.h | 1 + 1 file changed, 1 insertion(+) (limited to 'osdep.h') diff --git a/osdep.h b/osdep.h index 970d767078..6eb9a49ec8 100644 --- a/osdep.h +++ b/osdep.h @@ -88,6 +88,7 @@ # define QEMU_GNUC_PREREQ(maj, min) 0 #endif +int qemu_daemon(int nochdir, int noclose); void *qemu_memalign(size_t alignment, size_t size); void *qemu_vmalloc(size_t size); void qemu_vfree(void *ptr); -- cgit v1.2.1