HOW TO UPCALL IN LINUX 2.6.28?

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

 



i tried to implement an upcall in linux 2.6.28 using the codes given in "http://people.ee.ethz.ch/~arkeller/linux/kernel_user_space_howto.html#ss7.1" ( i have attached them)
but it just doesnt work....

it does printk the very first msg but at the call instruction it gives an error

also plz help me know about the environment variables
#include <string.h>

int main(int argc, char *argv[]){
	char command[10] = "beep -r ";
	if(argv[1] != NULL) {	
		strncat(command, argv[1], 1);
	}
	else
		strncat(command, "1", 1);
	system(command);
	return 0;
}
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <asm/uaccess.h>


static int __init usermodehelper_example_init(void)
{
	int ret = 0;
	char *argv[] = {"/home/arkeller/eth/paper/code/callee", "2", NULL };
	char *envp[] = {"HOME=/", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };

	printk("usermodehelper: init\n");
	/* last parameter: 1 -> wait until execution has finished, 0 go ahead without waiting*/
	/* returns 0 if usermode process was started successfully, errorvalue otherwise*/
	/* no possiblity to get return value of usermode process*/
	ret = call_usermodehelper("/home/arkeller/eth/paper/code/callee", argv, envp, UMH_WAIT_EXEC);
	if (ret != 0)
		printk("error in call to usermodehelper: %i\n", ret);
	else
		printk("everything all right\n");
        return 0;
}

static void __exit usermodehelper_example_exit(void)
{
	printk("usermodehelper: exit\n");
}

module_init(usermodehelper_example_init);
module_exit(usermodehelper_example_exit);
MODULE_LICENSE("GPL");

[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