Subject: [PATCH] Limit SO_BSDCOMPAT warning

From: Andi Kleen <[email-masked]>
Date: Fri, 24 Oct 2003 22:57:07 +0200

Warning a few times for each process is enough.

-Andi

diff -u linux-2.6.0test7/net/core/sock.c-o linux-2.6.0test7mm1-averell/net/core/sock.c
--- linux-2.6.0test7mm1/net/core/sock.c-o	2003-10-16 05:19:13.000000000 +0200
+++ linux-2.6.0test7mm1/net/core/sock.c	2003-10-24 22:30:46.000000000 +0200
@@ -154,8 +154,14 @@
 
 static void sock_warn_obsolete_bsdism(const char *name)
 {
-	printk(KERN_WARNING "process `%s' is using obsolete "
-	       "%s SO_BSDCOMPAT\n", current->comm, name);
+	static int warned;
+	static char warncomm[16];
+	if (strcmp(warncomm, current->comm) && warned < 5) { 
+		strcpy(warncomm,  current->comm); 
+		printk(KERN_WARNING "process `%s' is using obsolete "
+		       "%s SO_BSDCOMPAT\n", warncomm, name);
+		warned++;
+	}
 }
 
 /*