lkml.org 
[lkml]   [1999]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.2.1 header conflicts
> #include <linux/nfs_fs.h>
>
> main()
> {
> return 0;
> }

> It seems as though there might be a conflict here. Is the preceding
> simple program false?

Hi, Dan. Usually it's best to use the kernel's headers (<scsi/...>,
<net/...>, <linux/...> and <asm/...>) only within the kernel or modules,
and the libc's headers only for applications. If you need something
that's not in the libc headers (and of course this simple program does
not), then one approach is to borrow just that section and put it in your
own header file (#include "my_nfs_stuff.h"), with a check that __linux__
is defined if you're using a Linux-specific feature. If it's something
that's only available in certain versions of Linux, you might check the
UTS_RELEASE or LINUX_VERSION_CODE in <linux/version.h>, making the
assumptions that the program will be run on the same system where it's
being compiled and that the headers in place reflect the kernel that's
being run. You might also offer it to the libc folks if you think it'll
be used much.

You might have a look at ddstar and autofs as examples.
__
Trevor Johnson


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site