]> git.proxmox.com Git - qemu.git/commit - oslib-posix.c
Darwin: Fix compilation warning regarding the deprecated daemon() function
authorAlexandre Raymond <cerbere@gmail.com>
Tue, 7 Jun 2011 03:34:10 +0000 (23:34 -0400)
committerAndreas Färber <andreas.faerber@web.de>
Tue, 14 Jun 2011 01:10:47 +0000 (03:10 +0200)
commitf97742d0d36810ea72a2bd40b3abb890589ea3b8
tree4e1548536ff67cdc341830d99c97311cee24dee8
parent7fee199cf9704587d4ed9eb23044970f2206debc
Darwin: Fix compilation warning regarding the deprecated daemon() function

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 <cerbere@gmail.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
osdep.h
oslib-posix.c
qemu-nbd.c