Results 1 to 8 of 8
Hello fellow members,
I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.
1. ...
- 04-12-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 4
Need help on basic Linux C++ programming with simple RTAI functions
Hello fellow members,
I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.
1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".
2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!\n");
return 0;
}
void cleanup_module(void)
{
printk("See you later!\n");
return;
}
- 04-12-2011 #2
sounds like a homework question
though i'm curious if this actually needs to be a kernel module? or just a regular application???
- 04-12-2011 #3Linux Newbie
- Join Date
- Apr 2010
- Location
- Novosibirsk, Russia
- Posts
- 136
The Linux Kernel
The Linux Kernel Module Programming Guide
I suppose it will help you )
- 04-13-2011 #4Just Joined!
- Join Date
- Apr 2011
- Posts
- 4
not homework question. its something i couldnt get working.
its kernel stuff
- 04-13-2011 #5Just Joined!
- Join Date
- Apr 2011
- Posts
- 4
its kernel stuff if anyone know how to do it
- 04-13-2011 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You are missing two macros that inform the kernel which is the init function, and which is the exit function. Try this:
Code:#include <linux/init.h> #include <linux/module.h> MODULE_LICENSE("GPL"); int init_module(void) { printk(KERN_ALERT "Hey there!\n"); return 0; } void cleanup_module(void) { printk(KERN_ALERT "See you later!\n"); } module_init(init_module); module_exit(cleanup_module);Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-13-2011 #7Just Joined!
- Join Date
- Apr 2011
- Posts
- 4
oh thanks. but what am i missing here?
1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".
2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.
- 04-13-2011 #8
i suggest you look at the previous link
i'm treading lightly around this because it still sounds suspiciously like schoolwork/homework
you need to look up what the module_init and module_exit functions are actually doing


Reply With Quote