public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: wdebruij@dds.nl
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.6.3 very small patch: libc compatibility for skbuff.h (userspace access to sk_buffs)
Date: Thu,  4 Mar 2004 13:49:18 +0100	[thread overview]
Message-ID: <1078404558.404725ceb404c@webmail.dds.nl> (raw)

[-- 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)		   */

             reply	other threads:[~2004-03-04 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-04 12:49 wdebruij [this message]
2004-03-04 13:39 ` [UPDATE] Re: [PATCH] 2.6.3 very small patch: libc compatibility for skbuff.h (userspace access to sk_buffs) wdebruij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1078404558.404725ceb404c@webmail.dds.nl \
    --to=wdebruij@dds.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox