Re: Header Problem with RH 8.0

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

 



ccing kernelnewbies. Because with most of these questions I am not sure on
the answer and I am doing an educated guess.

> >>I was recently trying a few Loadable Kernel Modules with Linux, and the
> >>traditional "Hello World!" module worked fine, except that I couldnt
> >>find which header file contains the prototype of printk() (gcc with
> >>-Wall gave a warning). Does any one know where is this function prototyped?
> >Sorry I don't know and unfounrtly not near a linux box to help. 8(
> I think its prototyped in kernel.h (the
> /usr/src/linux/include/linux/kerner.h), because, again, my
> /usr/include/linux/kernel.h was only partial and didn't have the prototype.
Don't use /usr/include/linux/kernel.h. 8) But seriously my
/usr/include has a prototype for printk. and it is the same for
/usr/src/linux/include. The reason why this is true is probly because
/usr/src/linux points to /usr/src/linx-2.4.20 which is the version that my
distro ships with.

> >>Now for the bigger problem: When I opened /usr/include/linux/fs.h, I
> >>didn't find the definition of the "struct file{}", which I needed for a
> >>module, though it was there in /usr/src/linux-2.4/include/linux/fs.h.
> >>The /usr/include header contained only a portion of the kernel header.
> >>So my question is this: How do I get the definition if "file struct".
> >>Which are the correct headers to be used in the modules: the kernel
> >>headers from the src/ directory, or from the /usr/include directory?
> >Modules should (must?) use the headers in the src directory.
> >The headers in the include directory is for user land apps.
> But if /usr/include headers are for userland programs, they why does it
> even have a /usr/include/linux directory having partial headers
> (meaning, each header having a portion of the actual headers from
> /usr/src/linux/include/linux/) ?
because userland apps don't need to know the whole truth of how something
works. They just need to know that it exists and that the function takes
foo and returns bar.

> Userland apps should have no use of
> these /usr/include/linux headers, right? Or is there some use?
I believe that libc needs those headers 8). I would think that userland
apps that talk directly to the kernel need those headers.

Read the faq at http://www.kernelnewbies.org/faq/  there is a question
labeled What's going on with the kernel headers ? which explains more.
-- 
Eric

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[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