Re: Linked lists for userspace programs in Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Attachment: pgpXday5j6zrH.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux