[libbsd 7/9] wlanstats: Do not use signals

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 10 06:08:33 UTC 2022


---
 freebsd/tools/tools/net80211/wlanstats/main.c | 22 +++++++------------
 .../wlanstats/rtems-bsd-wlanstats-main-data.h |  2 --
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/freebsd/tools/tools/net80211/wlanstats/main.c b/freebsd/tools/tools/net80211/wlanstats/main.c
index 3a6fd204..ef2caf56 100644
--- a/freebsd/tools/tools/net80211/wlanstats/main.c
+++ b/freebsd/tools/tools/net80211/wlanstats/main.c
@@ -43,6 +43,7 @@
 #ifdef __rtems__
 #define __need_getopt_newlib
 #include <getopt.h>
+#include <string.h>
 #include <machine/rtems-bsd-program.h>
 #include <machine/rtems-bsd-commands.h>
 #endif /* __rtems__ */
@@ -96,6 +97,7 @@ getfmt(const char *tag)
 	return tag;
 }
 
+#ifndef __rtems__
 static int signalled;
 
 static void
@@ -103,6 +105,7 @@ catchalarm(int signo __unused)
 {
 	signalled = 1;
 }
+#endif /* __rtems__ */
 
 #if 0
 static void
@@ -262,6 +265,7 @@ main(int argc, char *argv[])
 	wf->setstamac(wf, mac);
 
 	if (argc > 0) {
+#ifndef __rtems__
 		u_long interval = strtoul(argv[0], NULL, 0);
 		int line, omask;
 
@@ -283,24 +287,10 @@ main(int argc, char *argv[])
 			wf->print_total(wf, stdout);
 		}
 		fflush(stdout);
-#ifndef __rtems__
 		omask = sigblock(sigmask(SIGALRM));
 		if (!signalled)
 			sigpause(0);
 		sigsetmask(omask);
-#else /* __rtems__ */
-		{
-		sigset_t oldmask, desired, empty;
-
-		sigemptyset(&empty);
-		sigemptyset(&desired);
-		sigaddset(&desired, SIGALRM);
-		sigprocmask(SIG_BLOCK, &desired, &oldmask);
-		while (!signalled)
-			sigsuspend(&desired);
-		sigprocmask(SIG_SETMASK, &oldmask, NULL);
-		}
-#endif /* __rtems__ */
 		signalled = 0;
 		alarm(interval);
 		line++;
@@ -346,6 +336,10 @@ main(int argc, char *argv[])
 			} while (len >= sizeof(struct ieee80211req_sta_info));
 		}
 #endif
+#else /* __rtems__ */
+		(void)mode;
+		printf("wlanstats: not implemented\n");
+#endif /* __rtems__ */
 	} else {
 		wf->collect_tot(wf);
 		wf->print_verbose(wf, stdout);
diff --git a/freebsd/tools/tools/net80211/wlanstats/rtems-bsd-wlanstats-main-data.h b/freebsd/tools/tools/net80211/wlanstats/rtems-bsd-wlanstats-main-data.h
index f88c5834..afb145be 100644
--- a/freebsd/tools/tools/net80211/wlanstats/rtems-bsd-wlanstats-main-data.h
+++ b/freebsd/tools/tools/net80211/wlanstats/rtems-bsd-wlanstats-main-data.h
@@ -1,5 +1,3 @@
 /* generated by userspace-header-gen.py */
 #include <rtems/linkersets.h>
 #include "rtems-bsd-wlanstats-data.h"
-/* main.c */
-RTEMS_LINKER_RWSET_CONTENT(bsd_prog_wlanstats, static int signalled);
-- 
2.35.3



More information about the devel mailing list