But what about kernel printfs?
Marc R.S. Chang Sing Pang
chang at philtis.UUCP
Thu May 5 18:00:52 AEST 1988
In article <12360 at tut.cis.ohio-state.edu> lvc at tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
>The discussion about compilers replacing function
>calls with something supposedly equivalent (and better)
>got me to wonder about all those UNIX kernel printfs.
>I guess the most portable thing to do would be to replace
>all the printfs (and other routines in the UNIX kernel)
>that clash with the C library with kprintf kexit etc.
>
>Even if one argues that an implementation of the UNIX
>kernel is not portable to other machines it should be
>at least portable to other compilers for the same cpu.
>
>Is there a better solution?
>
>--
>Larry Cipriani, AT&T Network Systems and Ohio State University
>Domain: lvc at tut.cis.ohio-state.edu
>Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)
You don't have to replace all those kernel printfs that clash with the C
library with kprintf, kexit etc. in the source. You can let the
preprocessor do the work for you.
e.g. Put in a .h file which is included in all the kernel source files the
following lines:
#define printf kprintf /* Use kernel printf for output */
#define exit kexit /* Use kernel exit, not library exit */
etc. etc. etc...
This way the compiler will never see a printf statement, only kprintfs.
---
Marc Chang Sing Pang
Philips, Corporate Cad Centre, Eindhoven, The Netherlands
uucp: {philabs!prlb2,mcvax}!philmds!philtis!chang
or: {philabs!prlb2}!prlb!chang-cadctr-decnet
Mail:
Nederlandse Philips Bedrijven B.V.
Corp. ISA/CAD Centre
Building SAQ-p794
P.O.Box 218
5600 MD Eindhoven
More information about the Comp.lang.c
mailing list