[comp.lang.c] But what about kernel printfs?

lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) (05/04/88)

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@tut.cis.ohio-state.edu
Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)

gwyn@brl-smoke.ARPA (Doug Gwyn ) (05/05/88)

In article <12360@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
>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.

One would think that the UNIX kernel would be compiled in what X3J11 has
termed a "freestanding" environment, not a "hosted" environment.  The
freestanding environment does not include <stdio.h>, printf(), etc.

chang@philtis.UUCP (Marc R.S. Chang Sing Pang) (05/05/88)

In article <12360@tut.cis.ohio-state.edu> lvc@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@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

nevin1@ihlpf.ATT.COM (00704a-Liber) (05/06/88)

In article <12360@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
>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.

Unfortunately, the implementation of the kernal (or is it kernel? :-)) is
not only CPU dependent but very machine-dependent.  I agree that an
implementation of the kernal should be written to avoid as many of these
dependencies as possible, but the dependencies on all of the supporting
hardware is still there.  For example: I would NOT expect A/UX to run on
any 680x0 machine except the Mac-II (and its' decendents).
-- 
 _ __			NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194
' )  )				"The secret compartment of my ring I fill
 /  / _ , __o  ____		 with an Underdog super-energy pill."
/  (_</_\/ <__/ / <_	These are solely MY opinions, not AT&T's, blah blah blah

limes@sun.uucp (Greg Limes) (05/07/88)

In article <4659@ihlpf.ATT.COM> nevin1@ihlpf.UUCP (00704a-Liber,N.J.) writes:
>In article <12360@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
>>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.
>
>Unfortunately, the implementation of the kernal (or is it kernel? :-)) is
>not only CPU dependent but very machine-dependent.  I agree that an
>implementation of the kernal should be written to avoid as many of these
>dependencies as possible, but the dependencies on all of the supporting
>hardware is still there.  For example: I would NOT expect A/UX to run on
>any 680x0 machine except the Mac-II (and its' decendents).

Don't be too sure. Remember that portable sections of the kernel can be
used to provide similar services on very different machines; that makes
porting to, say, a new product line easier. While I was not part of the
porting team, I can imagine how portable (and nonportable) code
impacted the jobs of the people setting up SunOS on the Sun-4 and the
Sun-386i. I *do* know that most of the source for SunOS 3.x is the same
between the Sun-3 and Sun-4 versions. Writing archetecture, machine, or
compiler dependent code without good reason may be asking for trouble
down the line.
-- 
   Greg Limes [limes@sun.com]			Illigitimi Non Carborundum

ok@quintus.UUCP (Richard A. O'Keefe) (05/07/88)

In article <4659@ihlpf.ATT.COM>, nevin1@ihlpf.ATT.COM (00704a-Liber) writes:
> Unfortunately, the implementation of the kernal (or is it kernel? :-)) is

Yes, it's kernel with two "e"s.  According to Webster's II:
"kernel ... 3: The most material and central part."

"-al" and "-ar" in English are morphemes connoting "pertaining to"
which form adjectives, so "kernal" would be an adjective meaning
"pertaining to an Irish or Scottish foot soldier (a kern)".

mouse@mcgill-vision.UUCP (der Mouse) (05/16/88)

In article <941@cresswell.quintus.UUCP>, ok@quintus.UUCP (Richard A. O'Keefe) writes:
> In article <4659@ihlpf.ATT.COM>, nevin1@ihlpf.ATT.COM (00704a-Liber) writes:
>> [...] the implementation of the kernal (or is it kernel? :-)) [...]

> Yes, it's kernel with two "e"s.  According to Webster's II:
> "kernel ... 3: The most material and central part."

Does anyone know where this widespread (on the net, at least)
impression that the privileged part of a system is called its "kernal"
came from?  It grates every time I see it, but I generally manage to
hold myself in check (I know I shouldn't flame spelling).

> "-al" and "-ar" in English are morphemes connoting "pertaining to"
> which form adjectives, so "kernal" would be an adjective meaning
> "pertaining to an Irish or Scottish foot soldier (a kern)".

"Kern" has another (entirely different) meaning in the context of
typesetting.

By the way, does anyone know whether this bears any relation to the
etymology of "colonel"?  I'm probably jumping at conclusions here, but
the sound is so peculiar for the spelling that there must be something
strange going on.

I'm taking it upon myself to move this to sci.lang, since it has
nothing to do with C any longer.

					der Mouse

			uucp: mouse@mcgill-vision.uucp
			arpa: mouse@larry.mcrcim.mcgill.edu

greg@ncr-sd.SanDiego.NCR.COM (Greg Noel) (05/17/88)

In article <1102@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP
(der Mouse) writes:
>Does anyone know where this widespread (on the net, at least)
>impression that the privileged part of a system is called its "kernal"
>came from?

One source is that Commodore's trade name for the operating system on the
C-64 is "kernal."  Those people with a microcomputer background would often
see it in the literature spelled that way and would not have realized that
it refered to a specific product and was not a generic term.

>It grates every time I see it, but I generally manage to
>hold myself in check (I know I shouldn't flame spelling).

The one that grates on me is the abuse of "it's."  The use of the apostrophe
is perhaps the only rule in English that has no exceptions -- I certainly
don't know of any others.  There's no excuse for someone intellegent enough
to program a computer to make a mistake using it.
-- 
-- Greg Noel, NCR Rancho Bernardo   Greg.Noel@SanDiego.NCR.COM  or  greg@ncr-sd

doug-merritt@cup.portal.com (05/18/88)

der Mouse asks about the etymology of the word "kernal" as opposed to
the standard spelling "kernel". It's from Commodore; that's the
word they used to describe their C64 "operating system".

Everyone else uses "kernel", and Commodore also uses "kernel" with
the newer Amiga line.
   Doug
---

doug-merritt@cup.portal.com (05/18/88)

Greg Noel writes:
>The one that grates on me is the abuse of "it's."  The use of the apostrophe
>is perhaps the only rule in English that has no exceptions -- I certainly
>don't know of any others.  There's no excuse for someone intellegent enough
>to program a computer to make a mistake using it.

Sure, it grates. But there certainly *is* an excuse...the two words
"its" and "it's" are pronounced exactly the same way, and unlike other
homophones, the misspelling is a question of punctuation rather than of
alphabet. There's less visual distinction to use for error correcting
feedback than there is with, say, "for" versus "four". I make sure of
the right spelling by mentally using the long form "it is"; so my
mnemonic is: if I can say "it is", I put in the apostrophe, otherwise
I leave it out.

If I am really rushed, hung over, disturbed, etc, then I may get sloppy
and fail to apply that rule. The resulting mistake seems no different
to me than any other kind of mistake, such as an error in mental arithmetic.
Some people get annoyed at that, too. I'm not sure I see why; to understand
all is to forgive all, no? To err is human...
	Doug
---
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

ericb@athertn.Atherton.COM (Eric Black) (05/19/88)

In article <2219@ncr-sd.SanDiego.NCR.COM> greg@ncr-sd.SanDiego.NCR.COM (Greg Noel) writes:
>The one that grates on me is the abuse of "it's."  The use of the apostrophe
>is perhaps the only rule in English that has no exceptions -- I certainly
>don't know of any others.  There's no excuse for someone intellegent enough
                                                           ^^^^^^^^^^
>to program a computer to make a mistake using it.
>-- 
>-- Greg Noel, NCR Rancho Bernardo   Greg.Noel@SanDiego.NCR.COM  or  greg@ncr-sd

I dunno, if their is any exceptions to that rule, than I dont now.
Looks like you loose!  <<< I think this one bothers me just as much, and
			   it seems to happen more often (at least on USENET)

Don't forget the ever-popular:
	Warning: something is hung (wont die); ps axl advised

I guess they couldn't figure out how to put an apostrophe into a
C string...

:-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-)

-- 
Eric Black	"Garbage in, Gospel out"
Atherton Technology, 1333 Bordeaux Dr., Sunnyvale, CA, 94089
   UUCP:	{sun,decwrl,hpda}!athertn!ericb
   Domainist:	ericb@Atherton.COM

colin@pdn.UUCP (Colin Kendall) (05/19/88)

In article <941@cresswell.quintus.UUCP>, ok@quintus.UUCP (Richard A. O'Keefe) writes:
> 
> Yes, it's kernel with two "e"s.  According to Webster's II:
> "kernel ... 3: The most material and central part."
> 
> "-al" and "-ar" in English are morphemes connoting "pertaining to"
> which form adjectives, so "kernal" would be an adjective meaning
> "pertaining to an Irish or Scottish foot soldier (a kern)".

Hence similarly:
 "vial", "pertaining to a popular Unix editor"
 "sisal", "pertaining to a female sibling"
 "radar", "pertaining to a dosage of radiation"
 "heal", "pertaining to a man"
 etc.

-- 
Colin Kendall				Paradyne Corporation
{gatech,akgua}!usfvax2!pdn!colin	Mail stop LF-207
Phone: (813) 530-8697			8550 Ulmerton Road, PO Box 2826
					Largo, FL  33294-2826

wesommer@athena.mit.edu (William Sommerfeld) (05/20/88)

In article <3181@pdn.UUCP> colin@pdn.UUCP (Colin Kendall) writes:
>Hence similarly:
> "vial", "pertaining to a popular Unix editor"
That's spelled "vile"! 
				- An Emacs user..

:-)

heather@blia.BLI.COM (Heather Mackinnon) (05/20/88)

In article <3181@pdn.UUCP>, colin@pdn.UUCP (Colin Kendall) writes:
> In article <941@cresswell.quintus.UUCP>, ok@quintus.UUCP (Richard A. O'Keefe) writes:
>  "heal", "pertaining to a man"

Actually, "heal" more correctly means "pertaining to a deity, organism
or artifact which is generally believed to be of the male sex".  Hence
the word "heal" is often used by owners of male dogs when their pets
spot another dog.

cramer@optilink.UUCP (Clayton Cramer) (05/24/88)

In article <5553@cup.portal.com>, doug-merritt@cup.portal.com writes:
> Greg Noel writes:
> >The one that grates on me is the abuse of "it's."  The use of the apostrophe
> >is perhaps the only rule in English that has no exceptions -- I certainly
> >don't know of any others.  There's no excuse for someone intellegent enough
                                                            ^^^^^^^^^^^
> >to program a computer to make a mistake using it.

And even less excuse to fail to spell "intelligent" correctly.






Clayton E. Cramer