<div dir="ltr">Hi,<div>Apologies from me. I didn&#39;t explain my problem properly. I am working on modifying the linux kernel&#39;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">&lt;<a href="mailto:Valdis.Kletnieks@vt.edu" target="_blank">Valdis.Kletnieks@vt.edu</a>&gt;</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>
&gt; 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>
&gt; 1. I used the modified version of list implementation given in<br>
&gt; <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>
&gt; program. But when I compiled the kernel, there were errors showing<br>
&gt; &#39;redefinition of struct&#39;, &#39;conflicting types&#39; etc.<br>
<br>
</div>You&#39;re recompiling the kernel for what reason?  You seem to be confused<br>
regarding kernel space versus userspace programming...<br>
<div class=""><br>
&gt; 2. When I tried to use list.h as such without any modifications, linked<br>
&gt; list functions in my userspace program were not identified by the compiler<br>
&gt; 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 &quot;linked list&quot;<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>
&gt; Would it be okay to modify the variable/function names in a copy of list.h<br>
&gt; and use it in the userspace program ?<br>
<br>
</div>You&#39;d probably be better off learning basic data structures well enough<br>
to write your own implementation.<br>
</blockquote></div><br></div>