From: Blue Swirl <blauwirbel@gmail.com>
To: Alexandre Raymond <cerbere@gmail.com>
Cc: andreas.faerber@web.de, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH] Darwin: Fix compilation warning regarding the deprecated daemon() function
Date: Sat, 4 Jun 2011 11:39:47 +0300 [thread overview]
Message-ID: <BANLkTinC8b2TULzmr5be+W+9xBsA-yoYug@mail.gmail.com> (raw)
In-Reply-To: <1306982755-19553-1-git-send-email-cerbere@gmail.com>
On Thu, Jun 2, 2011 at 5:45 AM, Alexandre Raymond <cerbere@gmail.com> wrote:
> On OSX > 10.5, daemon() is deprecated, resulting int he 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
>
> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
> ---
> 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__
> +#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__
> +#undef daemon
> +extern int daemon(int, int);
> +#endif
> +
Please introduce a wrapper instead, for example in oslib-posix.c. Then
the #ifdeffery is not spread to generic files.
prev parent reply other threads:[~2011-06-04 8:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 2:45 [Qemu-devel] [RFC PATCH] Darwin: Fix compilation warning regarding the deprecated daemon() function Alexandre Raymond
2011-06-02 12:09 ` Andreas Färber
2011-06-02 13:34 ` Alexandre Raymond
2011-06-02 13:55 ` Peter Maydell
2011-06-04 8:39 ` Blue Swirl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTinC8b2TULzmr5be+W+9xBsA-yoYug@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=andreas.faerber@web.de \
--cc=cerbere@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).