Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    how to use linux's own linked list implementation globally

    hi there i'm a newbie about kernel programming and i have to do a project about changing some stuff on linux scheduler function. Moreover, i want to use a linked list for being more clear rather than an array. However, i 'm facing with some problems about using a linked list globally which derived from kernel's own linked list implementation. First of all, i read this simple document to start progress.

    now i hope i will be clear to you. First, i defined a header file (

    directory which contains the data structure i will use and the code is like this.

    #include <linux/linkage.h>
    #include <linux/vmalloc.h>
    #include <linux/list.h>
    typedef struct node{
            struct list_head mylist; /* kernel's list structure */
            long int project_pid;
            long project_ticket_number;
    secondly, i defined my own system call file
    directory and this .c contains

    #include <linux/sample.h>
    #include <linux/project_header.h>
    long int maximum_ticket_number=0;
    LIST_HEAD(mylinkedlist) ; //to represent the start (head) of our list
    asmlinkage void sys_sample(void){
            NODE* temp=NULL;
            struct list_head* position = NULL;
            list_for_each(position, &mylinkedlist){
                    temp = list_entry(position, NODE, mylist);
                    printk("data = %ld\n", temp->project_pid);
    so my main question is how i can use or call this main linked list (mylinkedlist) in fork.c and sched.c. or how i suppose to define mylinkedlist ?

    i hope i been clear and understandable to you and i will be very glad if you can help me and thanks anyway...

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    3rd rock from sun - Often seen near moon
    I don't know the answer I hope some other member will reply btw, have you posted the question in mailing list? That's excellent resource for kernel newbies
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    FOSS India Award winning ext3fs Undelete tool Online Linux Terminal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts