[netfilter-cvslog] r4143 - trunk/nfsim/kernelenv

rusty at netfilter.org rusty at netfilter.org
Thu Jul 21 04:00:53 CEST 2005


Author: rusty at netfilter.org
Date: 2005-07-21 04:00:51 +0200 (Thu, 21 Jul 2005)
New Revision: 4143

Modified:
   trunk/nfsim/kernelenv/kernelenv.c
Log:
Fix sema_init logic: 1 means "unlocked" for semaphores.  Might as well handle 1 and 0 since it's trivial.


Modified: trunk/nfsim/kernelenv/kernelenv.c
===================================================================
--- trunk/nfsim/kernelenv/kernelenv.c	2005-07-21 01:59:42 UTC (rev 4142)
+++ trunk/nfsim/kernelenv/kernelenv.c	2005-07-21 02:00:51 UTC (rev 4143)
@@ -703,9 +703,12 @@
 
 void sema_init(struct semaphore *sem, int val)
 {
-	if (val)
-		barf("Non-zero-init semaphores not supported");
 	spin_lock_init(&sem->lock);
+
+	if (val == 0)
+		__down(sem, "sema_init");
+	else if (val != 1)
+		barf("Non-binary semaphores not supported");
 }
 
 /* bitops.h */




More information about the netfilter-cvslog mailing list