Date: Sat, 21 Jun 2014 17:34:52 -0700 From: John-Mark Gurney <jmg@funkthat.com> To: Rui Paulo <rpaulo@FreeBSD.org> Cc: freebsd-arch@FreeBSD.org Subject: Re: conflict between netif and pccard_ether... Message-ID: <20140622003452.GR31367@funkthat.com> In-Reply-To: <9318E9E1-DF4C-4126-BD93-AF215BE1720A@FreeBSD.org> References: <20140618231318.GH31367@funkthat.com> <201406190917.16458.jhb@freebsd.org> <20140621104031.GM31367@funkthat.com> <9318E9E1-DF4C-4126-BD93-AF215BE1720A@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--rwgQ89ZNnFUwFHTC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Rui Paulo wrote this message on Sat, Jun 21, 2014 at 09:54 -0700: > On Jun 21, 2014, at 3:40, John-Mark Gurney <jmg@funkthat.com> wrote: > > > <wpa.diff> > > We would prefer to submit this to the vendor, so if you can, please make sure this code compiles only on FreeBSD while leaving the rest untouched. Whee diff -D! New patch attached... Will you submit it upstream? and when can we expect this to hit head? Thanks. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." --rwgQ89ZNnFUwFHTC Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="os_unix.c.patch" --- os_unix.c.orig 2014-06-22 07:20:23.000000000 +0700 +++ os_unix.c 2014-06-22 07:32:52.000000000 +0700 @@ -153,16 +153,40 @@ #endif /* __APPLE__ */ +#ifdef __FreeBSD__ +#include <err.h> +#include <libutil.h> +#include <stdint.h> +#endif /* __FreeBSD__ */ + int os_daemonize(const char *pid_file) { #if defined(__uClinux__) || defined(__sun__) return -1; #else /* defined(__uClinux__) || defined(__sun__) */ +#ifdef __FreeBSD__ + pid_t otherpid; + struct pidfh *pfh; + + pfh = pidfile_open(pid_file, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) { + errx(1, "Daemon already running, pid: %jd.", + (intmax_t)otherpid); + } + warn("Cannot open or create pidfile."); + } +#endif /* __FreeBSD__ */ + if (os_daemon(0, 0)) { perror("daemon"); +#ifdef __FreeBSD__ + pidfile_remove(pfh); +#endif /* __FreeBSD__ */ return -1; } +#ifndef __FreeBSD__ if (pid_file) { FILE *f = fopen(pid_file, "w"); if (f) { @@ -170,6 +194,9 @@ fclose(f); } } +#else /* __FreeBSD__ */ + pidfile_write(pfh); +#endif /* __FreeBSD__ */ return -0; #endif /* defined(__uClinux__) || defined(__sun__) */ --rwgQ89ZNnFUwFHTC--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140622003452.GR31367>