Hi,
Apologies from me. I didn't explain my problem properly. I am working on modifying the linux kernel's scheduler framework to include support for real-time algorithms. In order to give user inputs such as number of tasks, their execution cost, period, deadline etc, I am creating an userspace program. Then this program would transfer control to the kernel to perform system calls for creation and execution of tasks. Thats why I had to recompile the kernel. I had planned to use linked list to contain the multiple execution cost values in each task (for a mixed criticality task system). As the control is transferred to the kernel, the linked list should be accessed from the kernel side also. As you had suggested, I had written my own implementation of linked lists. Please advise me on how to make this implementation (contained in a header file) common to both kernel and userspace ? Thank you for your time.  

Regards,
chandru


On Mon, Jun 16, 2014 at 11:24 AM, <Valdis.Kletnieks@vt.edu> wrote:
On Sat, 14 Jun 2014 02:38:19 +0800, Chandrasekaran Sivakumar said:

> I wanted to use linked lists in one of my userspace programs in Linux.

Userspace.  Remember that word.

> 1. I used the modified version of list implementation given in
> http://isis.poly.edu/kulesh/stuff/src/klist/list.h for my userspace
> program. But when I compiled the kernel, there were errors showing
> 'redefinition of struct', 'conflicting types' etc.

You're recompiling the kernel for what reason?  You seem to be confused
regarding kernel space versus userspace programming...

> 2. When I tried to use list.h as such without any modifications, linked
> list functions in my userspace program were not identified by the compiler
> and displayed as undefined.

This sounds like you need an introductory C class.
Did you remember to #include them?

Oh, by the way, keep in mind that the Linux kernel "linked list"
is actually a circularly linked list - as a result, treating it as a
normal linked list (particularly when checking for empty list or end-of-list)
is likely to result in hilarity and hijinks for all...

> Would it be okay to modify the variable/function names in a copy of list.h
> and use it in the userspace program ?

You'd probably be better off learning basic data structures well enough
to write your own implementation.