kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Linked lists for userspace programs in Linux
Date: Sun, 15 Jun 2014 23:24:17 -0400	[thread overview]
Message-ID: <128275.1402889057@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Sat, 14 Jun 2014 02:38:19 +0800." <CAPAiGB9JEqVNK=e2Rcgb_Dcu26gJqT-QE4j8ya6qdV44YaRrqQ@mail.gmail.com>

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140615/ef9bf990/attachment.bin 

  reply	other threads:[~2014-06-16  3:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13 18:38 Linked lists for userspace programs in Linux Chandrasekaran Sivakumar
2014-06-16  3:24 ` Valdis.Kletnieks at vt.edu [this message]
2014-06-16  8:13   ` Robert P. J. Day
2014-06-16 13:35   ` Chandrasekaran Sivakumar
2014-06-16 16:01     ` Valdis.Kletnieks at vt.edu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=128275.1402889057@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).