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

    Testing linux 2.6.5 kernel workqueue

    Hello all,

    I write a small linux module on Suse server Interprise 9.0 to test out linux workqueue which is shown below. The function MyThread gets called but the data passed to it is wrong. Do you have any idea why? Any help is greatly appreciated. Thank you in advance.

    #include <linux/workqueue.h>
    #include <linux/init.h>
    #include <linux/module.h>
    #include <linux/slab.h>


    void MyThread(void *data);
    static int datapassed;
    static struct work_struct *ncbWorkStruct;

    static int __init TestNcb_init(void)
    datapassed = 0x99;

    ncbWorkStruct = kmalloc(sizeof(struct work_struct), GFP_ATOMIC);
    INIT_WORK(ncbWorkStruct, MyThread, &datapassed);
    printk(KERN_ALERT "End Init\n");
    return 0;

    static void __exit TestNcb_exit(void)
    printk(KERN_ALERT "End Exit\n");

    void MyThread(void *data)
    int local = (int)*((int *)data);

    /* local is supposed to be 0x99 but it is fd968000 which is wrong */
    printk("&&& DataPassed is %x\n", local);
    printk("&&& Data is %x\n", datapassed);


  2. #2
    Linux Newbie
    Join Date
    Dec 2004
    Barrie, Ontario
    Please refrain from posting the same post multiple times.

    To reply to this thread, please use the other copy in the Linux Kernel section.
    Blog - KB5UMQ - Linux User #272983
    3 Rules:
    1) "It doesn't work..." is simply not useful information.
    2) Don't cross post!
    3) If you are asking for help, start by telling us your distro/os and version.

Posting Permissions

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