Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jun 2014 22:28:18 -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:  <20140622052818.GU31367@funkthat.com>
In-Reply-To: <EC40E4D6-630E-40D4-A08C-73760109A971@FreeBSD.org>
References:  <20140618231318.GH31367@funkthat.com> <201406190917.16458.jhb@freebsd.org> <20140621104031.GM31367@funkthat.com> <9318E9E1-DF4C-4126-BD93-AF215BE1720A@FreeBSD.org> <20140622003452.GR31367@funkthat.com> <EC40E4D6-630E-40D4-A08C-73760109A971@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--6K2R/cS9K4qvcBNq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Rui Paulo wrote this message on Sat, Jun 21, 2014 at 21:55 -0700:
> On Jun 21, 2014, at 17:34, John-Mark Gurney <jmg@funkthat.com> wrote:
> 
> > 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?
> 
> 
> The upstream repository is here:
> 
> 	http://hostap.epitest.fi/cgit/hostap/
> 
> Is there any way I can convince you to produce a patch suitable for this repository?  We can them email it to Jouni.

Ok, it's attached, but I don't know how to properly test using that
repo, so it hasn't been compiled or anything...  I just took the diff
that worked, and applied it to the repo, and there was some offset,
but applied clealy otherwise...

> It will be a while before I can update the tools in FreeBSD, so go ahead and commit it.

I'll commit it shortly...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

--6K2R/cS9K4qvcBNq
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="hostap.git.patch"

diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c
index 008ec6b..5853375 100644
--- a/src/utils/os_unix.c
+++ b/src/utils/os_unix.c
@@ -190,16 +190,40 @@ static int os_daemon(int nochdir, int noclose)
 #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) {
@@ -207,6 +231,9 @@ int os_daemonize(const char *pid_file)
 			fclose(f);
 		}
 	}
+#else /* __FreeBSD__ */
+	pidfile_write(pfh);
+#endif /* __FreeBSD__ */
 
 	return -0;
 #endif /* defined(__uClinux__) || defined(__sun__) */

--6K2R/cS9K4qvcBNq--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140622052818.GU31367>