[rtems-libbsd commit] netstat/if.c: Use POSIX not BSD signals

Joel Sherrill joel at rtems.org
Tue Oct 23 16:09:59 UTC 2012


Module:    rtems-libbsd
Branch:    master
Commit:    346810af6595850859f503ac734144cfc5956f58
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=346810af6595850859f503ac734144cfc5956f58

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Mon Oct 22 14:43:57 2012 -0500

netstat/if.c: Use POSIX not BSD signals

---

 freebsd-userspace/commands/usr.bin/netstat/if.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/freebsd-userspace/commands/usr.bin/netstat/if.c b/freebsd-userspace/commands/usr.bin/netstat/if.c
index ca751c4..2bf86b6 100644
--- a/freebsd-userspace/commands/usr.bin/netstat/if.c
+++ b/freebsd-userspace/commands/usr.bin/netstat/if.c
@@ -712,14 +712,25 @@ loop:
 	fflush(stdout);
 	if ((noutputs != 0) && (--noutputs == 0))
 		exit(0);
-#ifndef __rtems__
+#ifdef __rtems__
+	{
+	sigset_t oldmask, desired, empty;
+
+	sigemptyset(&empty);
+	sigemptyset(&desired);
+	sigaddset(&desired, SIGALRM);
+	sigprocmask(SIG_BLOCK, &desired, &oldmask);
+	while (!signalled)
+		sigsuspend(&desired);
+	signalled = NO;
+	sigprocmask(SIG_SETMASK, &oldmask, NULL);
+	}
+#else
 	oldmask = sigblock(sigmask(SIGALRM));
 	while (!signalled)
 		sigpause(0);
 	signalled = NO;
 	sigsetmask(oldmask);
-#else
-	#warning "Add BSD Signals wrapper"
 #endif
 	line++;
 	first = 0;




More information about the vc mailing list