[netfilter-cvslog] r3536 - in trunk/nfsim/kernelenv: . include

rusty at netfilter.org rusty at netfilter.org
Sat Jan 1 09:20:48 CET 2005


Author: rusty at netfilter.org
Date: 2005-01-01 09:20:47 +0100 (Sat, 01 Jan 2005)
New Revision: 3536

Modified:
   trunk/nfsim/kernelenv/include/kernelenv.h
   trunk/nfsim/kernelenv/kernelenv.c
Log:
down_interruptible() can fail: insert failure point.


Modified: trunk/nfsim/kernelenv/include/kernelenv.h
===================================================================
--- trunk/nfsim/kernelenv/include/kernelenv.h	2005-01-01 01:31:51 UTC (rev 3535)
+++ trunk/nfsim/kernelenv/include/kernelenv.h	2005-01-01 08:20:47 UTC (rev 3536)
@@ -886,13 +886,14 @@
 };
 #define DECLARE_MUTEX(name) struct semaphore name = { 1, 1 }
 
-#define down(x) (void)__down((x),__location__)
-#define down_interruptible(x) __down((x),__location__)
+#define down(x) __down((x),__location__)
+#define down_interruptible(x) __down_interruptible((x),__location__)
 
 #define up(x) __up((x),__location__)
 #define down_trylock(x) __down_trylock((x),__location__)
 
-int __down(struct semaphore *sem, const char *location);
+void __down(struct semaphore *sem, const char *location);
+int __down_interruptible(struct semaphore *sem, const char *location);
 
 void __up(struct semaphore *sem, const char *location);
 

Modified: trunk/nfsim/kernelenv/kernelenv.c
===================================================================
--- trunk/nfsim/kernelenv/kernelenv.c	2005-01-01 01:31:51 UTC (rev 3535)
+++ trunk/nfsim/kernelenv/kernelenv.c	2005-01-01 08:20:47 UTC (rev 3536)
@@ -495,12 +495,23 @@
 }
 
 /* semaphore */
-int __down(struct semaphore *sem, const char *location)
+void __down(struct semaphore *sem, const char *location)
 {
 	if (!(sem->count)--)
 		barf("down() unavailable at %s\n", location);
 
 	field_attach_static(sem, location, NULL);
+}
+
+int __down_interruptible(struct semaphore *sem, const char *location)
+{
+	if (should_i_fail(location))
+		return -EINTR;
+
+	if (!(sem->count)--)
+		barf("down() unavailable at %s\n", location);
+
+	field_attach_static(sem, location, NULL);
 	return 0;
 }
 




More information about the netfilter-cvslog mailing list