-
imcomplete kernel.h
Hi,
I am new to linux kernel stuff.
I tried to write up my first kernel program as the following:
#include <linux/kernel.h>
#include <linux/module.h>
int init_module()
{
printk("Kernel speaking\n");
return 0;
}
void cleanup_module()
{
printk("Short-lived program \n");
}
However when I compile, I got
hello.c:6: warning: implicit declaration of function `printk'
The prink is supposed to be defined in kernel.h.
However the current kernel.h on my workstation is very short:
#ifndef _LINUX_KERNEL_H
#define _LINUX_KERNEL_H
/*
* 'kernel.h' contains some often-used function prototypes etc
*/
#define SI_LOAD_SHIFT 16
struct sysinfo {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* swap space still available */
unsigned short procs; /* Number of current processes */
unsigned short pad; /* explicit padding for m68k */
unsigned long totalhigh; /* Total high memory size */
unsigned long freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};
#endif
Anyone has any ideas?
Thanks
-
try:
#include <linux/module.h>
#include <linux/init.h>
int init_module()
{
printk("Kernel speaking\n");
return 0;
}
void cleanup_module()
{
printk("Short-lived program \n");
}
module_init(init_module);
module_exit(cleanup_module);