Received: from eggs.gnu.org ([140.186.70.92]:56719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS6jo-0001d8-RT for qemu-devel@nongnu.org; Thu, 02 Jun 2011 08:10:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QS6jm-00009I-RC for qemu-devel@nongnu.org; Thu, 02 Jun 2011 08:10:56 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:44421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS6jm-000093-1X for qemu-devel@nongnu.org; Thu, 02 Jun 2011 08:10:54 -0400 Message-Id: <8238047B-5274-4618-8781-7417F7AF2238@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: <1306982755-19553-1-git-send-email-cerbere@gmail.com> Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v936) Date: Thu, 2 Jun 2011 14:09:32 +0200 References: <1306982755-19553-1-git-send-email-cerbere@gmail.com> Sender: andreas.faerber@web.de Subject: Re: [Qemu-devel] [RFC PATCH] Darwin: Fix compilation warning regarding the deprecated daemon() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexandre Raymond Cc: Blue Swirl , QEMU Developers Am 02.06.2011 um 04:45 schrieb Alexandre Raymond: > On OSX > 10.5, daemon() is deprecated, resulting int he following =20 > warning: >=3D 10.5 http://developer.apple.com/library/mac/#documentation/Darwin/Reference/=20= ManPages/man3/daemon.3.html > ----8<---- > qemu-nbd.c: In function =91main=92: > qemu-nbd.c:371: warning: =91daemon=92 is deprecated (declared at /usr/=20= > include/stdlib.h:289) > ----8<---- > > The following trick, used in mDNSResponder, takes care of this =20 > 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 =20 hack for curing symptoms. http://developer.apple.com/library/mac/technotes/tn2083/_index.html#//=20= apple_ref/doc/uid/DTS10003794-CH1-SUBSECTION64 Possibly a better fix would be to supply a .plist file for use with =20 launchd/launchctl and to #ifndef __APPLE__ the daemon() functionality? Further comments inline. > Signed-off-by: Alexandre Raymond > --- > 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 licenses/>. > */ > > +#if __APPLE__ #ifdef __APPLE__ > +#define daemon fake_daemon_function > +#endif > + > #include > #include "block_int.h" > #include "nbd.h" > @@ -32,6 +36,11 @@ > #include > #include > > +#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) > --=20 > 1.7.5 Andreas=