public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation
@ 2000-12-11 22:59 Adam J. Richter
  2000-12-12  1:05 ` Keith Owens
  2000-12-12  1:13 ` Mohammad A. Haque
  0 siblings, 2 replies; 6+ messages in thread
From: Adam J. Richter @ 2000-12-11 22:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

[-- Attachment #1: Type: text/plain, Size: 690 bytes --]


	linux-2.4.0test12pre8/include/linux/module.h contains some
kernel-specific declarations that now reference struct list_head, which
which is only defined when __KERNEL__ is set.  This causes sysklogd
and probably any other user level program that needs to include
<linux/module.h> to fail to compile.

	The following patch brackets the (unused) offending declarations
in #ifdef __KERNEL__...#endif.

-- 
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

[-- Attachment #2: modules.diff --]
[-- Type: text/plain, Size: 722 bytes --]

Index: linux/include/linux/module.h
===================================================================
RCS file: /usr/src.repository/repository/linux/include/linux/module.h,v
retrieving revision 1.2
diff -u -r1.2 module.h
--- linux/include/linux/module.h	2000/12/04 11:57:16	1.2
+++ linux/include/linux/module.h	2000/12/11 22:54:20
@@ -168,6 +168,7 @@
  * Keith Owens <kaos@ocs.com.au> 28 Oct 2000.
  */
 
+#ifdef __KERNEL__
 #define HAVE_INTER_MODULE
 extern void inter_module_register(const char *, struct module *, const void *);
 extern void inter_module_unregister(const char *);
@@ -183,6 +184,7 @@
 };
 
 extern int try_inc_mod_count(struct module *mod);
+#endif
 
 #if defined(MODULE) && !defined(__GENKSYMS__)
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation
  2000-12-11 22:59 PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation Adam J. Richter
@ 2000-12-12  1:05 ` Keith Owens
  2000-12-12  1:15   ` Cort Dougan
  2000-12-12  1:13 ` Mohammad A. Haque
  1 sibling, 1 reply; 6+ messages in thread
From: Keith Owens @ 2000-12-12  1:05 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: linux-kernel, torvalds

On Mon, 11 Dec 2000 14:59:01 -0800, 
"Adam J. Richter" <adam@yggdrasil.com> wrote:
>	linux-2.4.0test12pre8/include/linux/module.h contains some
>kernel-specific declarations that now reference struct list_head, which
>which is only defined when __KERNEL__ is set.  This causes sysklogd
>and probably any other user level program that needs to include
><linux/module.h> to fail to compile.
>
>	The following patch brackets the (unused) offending declarations
>in #ifdef __KERNEL__...#endif.

Linus, please do not apply.

User space applications _must_ not include kernel headers.  Even
modutils does not include linux/module.h, it has its own portable
(kernels 2.0 - 2.4) version.

I have strongly recommended to the sysklogd maintainers that they strip
all the symbol handling from klogd.  The oops decoding in klogd is
hopelessly out of date and broken.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd  compilation
  2000-12-11 22:59 PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation Adam J. Richter
  2000-12-12  1:05 ` Keith Owens
@ 2000-12-12  1:13 ` Mohammad A. Haque
  2000-12-12  1:53   ` Peter Samuelson
  1 sibling, 1 reply; 6+ messages in thread
From: Mohammad A. Haque @ 2000-12-12  1:13 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: linux-kernel, torvalds

Wasn't there discussion that user space apps shouldn't include kernel
headers?

"Adam J. Richter" wrote:
> 
>         linux-2.4.0test12pre8/include/linux/module.h contains some
> kernel-specific declarations that now reference struct list_head, which
> which is only defined when __KERNEL__ is set.  This causes sysklogd
> and probably any other user level program that needs to include
> <linux/module.h> to fail to compile.
> 
>         The following patch brackets the (unused) offending declarations
> in #ifdef __KERNEL__...#endif.

-- 

=====================================================================
Mohammad A. Haque                              http://www.haque.net/ 
                                               mhaque@haque.net

  "Alcohol and calculus don't mix.             Project Lead
   Don't drink and derive." --Unknown          http://wm.themes.org/
                                               batmanppc@themes.org
=====================================================================
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation
  2000-12-12  1:05 ` Keith Owens
@ 2000-12-12  1:15   ` Cort Dougan
  0 siblings, 0 replies; 6+ messages in thread
From: Cort Dougan @ 2000-12-12  1:15 UTC (permalink / raw)
  To: Keith Owens; +Cc: Adam J. Richter, linux-kernel, torvalds

} User space applications _must_ not include kernel headers.  Even
} modutils does not include linux/module.h, it has its own portable
} (kernels 2.0 - 2.4) version.

There are cases where a user-program _must_ include kernel headers.  Some
glibc versions have incorrect values for MCL_* and asm/mman.h has correct
versions.  If you want your mlock call to do anything, you need the kernel
header.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation
  2000-12-12  1:13 ` Mohammad A. Haque
@ 2000-12-12  1:53   ` Peter Samuelson
  2000-12-12 20:38     ` Frank van Maarseveen
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Samuelson @ 2000-12-12  1:53 UTC (permalink / raw)
  To: Mohammad A. Haque; +Cc: Adam J. Richter, linux-kernel, torvalds


[Mohammad A. Haque]
> Wasn't there discussion that user space apps shouldn't include kernel
> headers?

Oh, it's been discussed, many times.  Here is my executive summary of
why nobody needs to use kernel headers in userspace programs, *EVER*:

Q: I want to #include <linux/foo.h> but I get compile errors, please
   apply this patch to foo.h.

A: Make a copy of foo.h, fix it up to compile properly in your
   application and ship it in your tarball.

Q: What if foo.h changes?  My copy will be out of date and my app will
   not work properly on new kernels.

A: This is exactly the same problem as userspace ABI drift.  And it has
   exactly the same solution: make sure userspace interfaces to kernel
   functionality are as stable as possible.  We really *do* try not to
   gratuitously break binaries ... except certain system utilities
   which are low-level enough to justify telling the user to upgrade
   (and that's a short list -- see Documentation/Changes.)

Q: What about new features?  What if foo.h gets some new ioctl
   definitions?  My copy won't have these and my app won't be able to
   use them.

A: So resync with the kernel copy, when the need arises.  Obviously
   your app won't magically be able to just use the new functionality
   without other changes on your part -- resyncing foo.h is just a
   small part of the changes you are already making anyway.

Q: I maintain a subsystem with tightly-coupled userspace and kernel
   components.

A: So maintain *your* header files however you wish, but just ship
   separate copies in your kernel patches and userspace tarballs.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation
  2000-12-12  1:53   ` Peter Samuelson
@ 2000-12-12 20:38     ` Frank van Maarseveen
  0 siblings, 0 replies; 6+ messages in thread
From: Frank van Maarseveen @ 2000-12-12 20:38 UTC (permalink / raw)
  To: Peter Samuelson
  Cc: Mohammad A. Haque, Adam J. Richter, linux-kernel, torvalds

On Mon, Dec 11, 2000 at 07:53:05PM -0600, Peter Samuelson wrote:
> 
> [Mohammad A. Haque]
> > Wasn't there discussion that user space apps shouldn't include kernel
> > headers?
> 
> Oh, it's been discussed, many times.  Here is my executive summary of
> why nobody needs to use kernel headers in userspace programs, *EVER*:
Oh, sounds reasonable. But:

Do the maintainers of strace, lm_sensors, the wacom input device in XFree
know this? (just to name a few)

The unanswered question remains:

$ cat `find linux/include/{linux,asm}/. -type f` |grep  '^#ifdef __KERNEL__'|wc
    246     514    4537

why is this?

Either: strip it or maintain it.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-12-12 21:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-11 22:59 PATCH: linux-2.4.0-test12pre8/include/linux/module.h breaks sysklogd compilation Adam J. Richter
2000-12-12  1:05 ` Keith Owens
2000-12-12  1:15   ` Cort Dougan
2000-12-12  1:13 ` Mohammad A. Haque
2000-12-12  1:53   ` Peter Samuelson
2000-12-12 20:38     ` Frank van Maarseveen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox