* [PATCH] 2.6.3 very small patch: libc compatibility for skbuff.h (userspace access to sk_buffs)
@ 2004-03-04 12:49 wdebruij
2004-03-04 13:39 ` [UPDATE] " wdebruij
0 siblings, 1 reply; 2+ messages in thread
From: wdebruij @ 2004-03-04 12:49 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 725 bytes --]
hi,
for a network monitoring application I needed access to sk_buff's from
userspace. The current linux/skbuff.h headerfile cannot be included from
userspace applications due to various kernel .h vs. libc .h clashes.
I basically pruned the #include statements by inserting #ifdef _KERNEL__
statements until gcc started complaining. Therefore nothing has changed in the
kernelspace implementation. But this minor change makes it possible to include
linux/skbuff.h from userspace.
Ideally, all the #ifdef __KERNEL__ secured headerfile references should be
removed, since it is clear that skbuff.h doesn't really rely on them. Perhaps
some .c file does, but I didn't feel like finding out which one.
cheers,
Willem
[-- Attachment #2: linux-2.6.3-skbuff_userspace_patch --]
[-- Type: application/octet-stream, Size: 758 bytes --]
--- linux-2.6.3-orig/include/linux/skbuff.h 2004-02-18 04:58:26.000000000 +0100
+++ linux-2.6.3/include/linux/skbuff.h 2004-03-04 09:36:55.827316800 +0100
@@ -14,19 +14,28 @@
#ifndef _LINUX_SKBUFF_H
#define _LINUX_SKBUFF_H
+#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
+#endif
+
#include <linux/time.h>
-#include <linux/cache.h>
+#ifdef __KERNEL__
+#include <linux/cache.h>
#include <asm/atomic.h>
#include <asm/types.h>
+#endif
+
#include <linux/spinlock.h>
+
+#ifdef __KERNEL__
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/poll.h>
#include <linux/net.h>
+#endif
#define HAVE_ALLOC_SKB /* For the drivers to know */
#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
^ permalink raw reply [flat|nested] 2+ messages in thread
* [UPDATE] Re: [PATCH] 2.6.3 very small patch: libc compatibility for skbuff.h (userspace access to sk_buffs)
2004-03-04 12:49 [PATCH] 2.6.3 very small patch: libc compatibility for skbuff.h (userspace access to sk_buffs) wdebruij
@ 2004-03-04 13:39 ` wdebruij
0 siblings, 0 replies; 2+ messages in thread
From: wdebruij @ 2004-03-04 13:39 UTC (permalink / raw)
To: wdebruij; +Cc: Alan Cox, linux-kernel@vger.kernel.org
new version. Now uses sys/time.h in userspace to resolve timevals. Also, the
patch mimetype is no longer (erroneously) reported as application/-octet-stream
(since I just pasted it in below).
----begin---
--- linux-2.6.3-orig/include/linux/skbuff.h 2004-02-18 04:58:26.000000000 +0100
+++ linux-2.6.3/include/linux/skbuff.h 2004-03-04 11:10:49.716489408 +0100
@@ -14,19 +14,26 @@
#ifndef _LINUX_SKBUFF_H
#define _LINUX_SKBUFF_H
+#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/time.h>
#include <linux/cache.h>
-
#include <asm/atomic.h>
+#else
+#include <sys/time.h>
+#endif
+
#include <asm/types.h>
#include <linux/spinlock.h>
+
+#ifdef __KERNEL__
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/poll.h>
#include <linux/net.h>
+#endif
#define HAVE_ALLOC_SKB /* For the drivers to know */
#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-03-04 13:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04 12:49 [PATCH] 2.6.3 very small patch: libc compatibility for skbuff.h (userspace access to sk_buffs) wdebruij
2004-03-04 13:39 ` [UPDATE] " wdebruij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox