socket: SOCK_DEBUG type checking
Subsystems (3)
PATCH 1/1 socket: SOCK_DEBUG type checking
Use the inline trick (same as pr_debug) to get checking of debug statements even if no code is generated.
include/net/sock.h +5 -1
@@ -70,7 +70,11 @@ #define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \ printk(KERN_DEBUG msg); } while (0)#else -#define SOCK_DEBUG(sk, msg...) do { } while (0) +/* Validate arguments and do nothing */ +static void inline int __attribute__ ((format (printf, 2, 3))) +SOCK_DEBUG(struct sock *sk, const char *msg, ...) +{ +} #endif/* This is the per-socket lock. The spinlock provides a synchronization
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 21 Mar 2008 07:51:32 -0700
Quoted 4 lines
Use the inline trick (same as
pr_debug) to get checking of debug statements even if no code is generated.Signed-off-by Stephen Hemminger <[email protected]>
Applied, and I'll push to net-2.6.26 after some build testing.
Although the use of SOCK_DEBUG is so esoteric and sparse, I can't see how any of it can be useful for any kind of debugging.
I'd say we should just remove this thing.
Quoted 8 lines · On Fri, 21 Mar 2008 15:56:00 -0700 (PDT) David Miller <[email protected]>…
From: Stephen Hemminger <[email protected]>
Date: Fri, 21 Mar 2008 07:51:32 -0700Quoted 4 lines
Use the inline trick (same as
pr_debug) to get checking of debug statements even if no code is generated.Signed-off-by Stephen Hemminger <[email protected]>
Quoted 8 lines
Applied, and I'll push to net-2.6.26 after some build testing.
Although the use of
SOCK_DEBUGis so esoteric and sparse, I can't see how any of it can be useful for any kind of debugging.I'd say we should just remove this thing.
Agreed, that was the other alternative, just saw it while looking at filter stuff.