All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: sounak chakraborty <sounakrin@yahoo.co.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: compilation problem of modules
Date: Wed, 02 Mar 2005 08:37:40 -0800	[thread overview]
Message-ID: <4225EBD4.8090302@osdl.org> (raw)
In-Reply-To: <20050302145907.17666.qmail@web53306.mail.yahoo.com>

sounak chakraborty wrote:
> the code of the module that i written is as follows:
> #define MODULE
> #include <linux/module.h>
> #include <linux/proc_fs.h>
> #define MODULE_NAME "manti"
> struct manti
> {
>       char mm[20];
>  };
> static struct proc_dir_entry *example_dir;
> struct manti m1;
> int init_module(void)
> {
>   example_dir=proc_mkdir(MODULE_NAME,NULL);
>  if(example_dir==NULL)
>   {
>      printk("<1> error in creation of proc file\n");
>     }
>   else
>    printk("<1>success in creation of proc dir\n");
>   }
> void cleanup_module(void)
> {
>    remove_proc_entry(MODULE_NAME,NULL);
>   printk("<1>proc entry removed\n");
>  }
> 
> here iam just making one directory in the proc file
> named manti
> i am trying to  compile it like
> gcc -c proc.c 
> where the kernel version is 2.4.20-8
> 
> but i am getting following errors 
> 
> In file included from proc.c:5:
> /usr/include/linux/proc_fs.h:47: parse error before
> "off_t"
> /usr/include/linux/proc_fs.h:51: parse error before
> "off_t"
> /usr/include/linux/proc_fs.h:57: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h:59: parse error before
> "uid"
> /usr/include/linux/proc_fs.h:60: parse error before
> "gid"
> /usr/include/linux/proc_fs.h:70: parse error before
> "count"
> /usr/include/linux/proc_fs.h:72: parse error before
> "rdev"
> /usr/include/linux/proc_fs.h:176: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `proc_net_create':
> /usr/include/linux/proc_fs.h:177: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h:177: (Each undeclared
> identifier is reported only once
> /usr/include/linux/proc_fs.h:177: for each function it
> appears in.)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:181: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `create_proc_entry':
> /usr/include/linux/proc_fs.h:181: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: In function
> `proc_symlink':
> /usr/include/linux/proc_fs.h:185: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:186: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `proc_mknod':
> /usr/include/linux/proc_fs.h:187: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: In function
> `proc_mkdir':
> /usr/include/linux/proc_fs.h:189: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:192: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h:193: parse error before
> "off_t"
> /usr/include/linux/proc_fs.h:193:
> `create_proc_read_entry' declared as function
> returning a function
> /usr/include/linux/proc_fs.h:196: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `create_proc_info_entry':
> /usr/include/linux/proc_fs.h:197: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:203: `NULL' used prior to
> declaration
> proc.c: In function `init_module':
> proc.c:16: `NULL' has an incomplete type
> proc.c:17: invalid operands to binary ==
> proc.c: In function `cleanup_module':
> proc.c:26: `NULL' has an incomplete type
> 
> 
> 
> how to solve it 
> plz help me
> is my compilation method is wrong or something else 

compile/build is wrong.
a minimum 2.4 kernel build needs at least:

gcc -c -D__KERNEL__ -DMODULE -O2 -nostdinc proc.c

and probably a few other flags/options.

-- 
~Randy

  reply	other threads:[~2005-03-02 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-02 14:59 compilation problem of modules sounak chakraborty
2005-03-02 16:37 ` Randy.Dunlap [this message]
2005-03-02 16:58   ` Tommy Reynolds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4225EBD4.8090302@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sounakrin@yahoo.co.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.