<div dir="ltr">Hi,<div>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. </div>
</div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">Regards,<div>chandru</div></div></div>
<br><br><div class="gmail_quote">On Mon, Jun 16, 2014 at 11:24 AM, <span dir="ltr"><<a href="mailto:Valdis.Kletnieks@vt.edu" target="_blank">Valdis.Kletnieks@vt.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On Sat, 14 Jun 2014 02:38:19 +0800, Chandrasekaran Sivakumar said:<br>
<br>
> I wanted to use linked lists in one of my userspace programs in Linux.<br>
<br>
</div>Userspace. Remember that word.<br>
<div class=""><br>
> 1. I used the modified version of list implementation given in<br>
> <a href="http://isis.poly.edu/kulesh/stuff/src/klist/list.h" target="_blank">http://isis.poly.edu/kulesh/stuff/src/klist/list.h</a> for my userspace<br>
> program. But when I compiled the kernel, there were errors showing<br>
> 'redefinition of struct', 'conflicting types' etc.<br>
<br>
</div>You're recompiling the kernel for what reason? You seem to be confused<br>
regarding kernel space versus userspace programming...<br>
<div class=""><br>
> 2. When I tried to use list.h as such without any modifications, linked<br>
> list functions in my userspace program were not identified by the compiler<br>
> and displayed as undefined.<br>
<br>
</div>This sounds like you need an introductory C class.<br>
Did you remember to #include them?<br>
<br>
Oh, by the way, keep in mind that the Linux kernel "linked list"<br>
is actually a circularly linked list - as a result, treating it as a<br>
normal linked list (particularly when checking for empty list or end-of-list)<br>
is likely to result in hilarity and hijinks for all...<br>
<div class=""><br>
> Would it be okay to modify the variable/function names in a copy of list.h<br>
> and use it in the userspace program ?<br>
<br>
</div>You'd probably be better off learning basic data structures well enough<br>
to write your own implementation.<br>
</blockquote></div><br></div>