LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2006, 12:42 PM   #1
dongthao
LQ Newbie
 
Registered: May 2006
Posts: 1

Rep: Reputation: 0
Test Kernel API


Hi all,
I'm reading about linux networking architecture. Now I want to test some kernel APIs in manipulating socket buffers so I write a very small program :-D to test the functions in skbuff.h file. First, I try the alloc_skb:
Code:
#include <linux/skbuff.h>
#include <socket.h>

int main(){
        sk_buff socketbuff;
        socketbuff = alloc_skb(12, GFP_DMA);
        return 0;
}
You see, a very simple program but when I compile with
Code:
gcc -o test testskbuff.c 
or
gcc -o test testskbuff.c -l /usr/include/linux
, the errors sank me!
Code:
In file included from /usr/include/linux/sched.h:14,
                 from /usr/include/linux/skbuff.h:19,
                 from testskbuff.c:1:
/usr/include/linux/timex.h:173: field `time' has incomplete type
In file included from /usr/include/linux/bitops.h:69,
                 from /usr/include/asm/system.h:7,
                 from /usr/include/linux/sched.h:16,
                 from /usr/include/linux/skbuff.h:19,
                 from testskbuff.c:1:
/usr/include/asm/bitops.h:327:2: warning: #warning This includefile is not available on all architectures.
/usr/include/asm/bitops.h:328:2: warning: #warning Using kernel headers in userspace: atomicity not guaranteed
In file included from /usr/include/linux/signal.h:4,
                 from /usr/include/linux/sched.h:25,
                 from /usr/include/linux/skbuff.h:19,
                 from testskbuff.c:1:
/usr/include/asm/signal.h:107: syntax error before "sigset_t"
/usr/include/asm/signal.h:110: syntax error before '}' token
In file included from /usr/include/linux/sched.h:81,
                 from /usr/include/linux/skbuff.h:19,
                 from testskbuff.c:1:
/usr/include/linux/timer.h:32: field `vec' has incomplete type
/usr/include/linux/timer.h:37: field `vec' has incomplete type
/usr/include/linux/timer.h:45: syntax error before "spinlock_t"
/usr/include/linux/timer.h:53: syntax error before '}' token
/usr/include/linux/timer.h:63: field `list' has incomplete type
/usr/include/linux/timer.h:67: syntax error before "tvec_base_t"
/usr/include/linux/timer.h:101: syntax error before "tvec_bases"
/usr/include/linux/timer.h: In function `init_timer':
....
My god! It's only a little bit on my screen. I guess that I have missed some including files but I can't know what exactly they are .
So can you explain me what happen and tell me what to do to run this simple program?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Test kernel 2.6.15.6- How to check this kernel is installed extremeware Slackware 2 04-11-2006 04:27 AM
Linux Kernel API Question Neruocomp Programming 2 06-23-2005 07:24 PM
kernel -cryptographic api denning Linux - Software 2 10-23-2004 03:33 AM
Socket API from Kernel Space codecowboy Programming 2 07-15-2004 02:20 AM
route table lookup Kernel API ?? Nalin Gupta Programming 0 07-01-2004 03:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration