Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12
I tried the simple approach. Ist got rid of write,then got rid of read. The problem that now surfacing is: read case :- userspace prog kust keeps on reading even ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined!
    Join Date
    Mar 2009
    Posts
    12

    tried read / write individually


    I tried the simple approach.
    Ist got rid of write,then got rid of read.

    The problem that now surfacing is:
    read case :- userspace prog kust keeps on reading even if no packet is being transmitted and when I try to send a packet the read is not executed.

    send=0;

    in read function()
    {
    printk("pqr");
    wait_event_interruptible(my_queue,send!=1);
    printk("stu");
    send=0;
    .
    .
    }

    in tranmit function ()
    {

    send=1;
    printk("abc");
    wake_up_interruptible(&my_queue);
    printk("xyz");

    }



    then in /var/log/messages I see:

    pqr
    stu
    pqr
    stu
    pqr
    stu
    pqr
    stu
    pqr
    stu
    pqr
    stu
    pqr
    stu

    abc
    xyz
    abc
    xyz
    abc
    xyz


    most of the times this is the sequence

    same with write.


    but when I read first the write then read occurs without any initiation(packet transmission) and userprog blocks on write.

    I am using netfilter in my module and seeing packets being in the system without any external packet generation, could it have anything to do with the problem.

  2. #12
    Just Joined!
    Join Date
    Jul 2009
    Posts
    49

    simplest case and debugging...

    First thing is to make sure that your transmit function is only activating the queue when a particular event happens. You are going to have to define that event and then use your debugging capabilities (also called "printk()" to prove to yourself that it is working properly and only going off in a deterministic manner. Until you have this working you can't really say that the read/write was or was not working.

    Cheers!!

Page 2 of 2 FirstFirst 1 2

Posting Permissions

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