[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH] Darwin: Fix compilation warning regarding t
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [RFC PATCH] Darwin: Fix compilation warning regarding the deprecated daemon() function |
Date: |
Thu, 2 Jun 2011 14:09:32 +0200 |
Am 02.06.2011 um 04:45 schrieb Alexandre Raymond:
On OSX > 10.5, daemon() is deprecated, resulting int he following
warning:
>= 10.5
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/
ManPages/man3/daemon.3.html
----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
Even if apparently applied by Apple themselves, I consider it a bad
hack for curing symptoms.
http://developer.apple.com/library/mac/technotes/tn2083/_index.html#//
apple_ref/doc/uid/DTS10003794-CH1-SUBSECTION64
Possibly a better fix would be to supply a .plist file for use with
launchd/launchctl and to #ifndef __APPLE__ the daemon() functionality?
Further comments inline.
Signed-off-by: Alexandre Raymond <address@hidden>
---
qemu-nbd.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index e858033..10b0791 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -16,6 +16,10 @@
* along with this program; if not, see <http://www.gnu.org/
licenses/>.
*/
+#if __APPLE__
#ifdef __APPLE__
+#define daemon fake_daemon_function
+#endif
+
#include <qemu-common.h>
#include "block_int.h"
#include "nbd.h"
@@ -32,6 +36,11 @@
#include <signal.h>
#include <libgen.h>
+#if __APPLE__
dito
+#undef daemon
+extern int daemon(int, int);
Blue Swirl has declared war on "extern"... ;)
+#endif
+
#define SOCKET_PATH "/var/lock/qemu-nbd-%s"
#define NBD_BUFFER_SIZE (1024*1024)
--
1.7.5
Andreas