[comp.unix.sysv386] Looking for kernel routine similar to sprintf

jwd@unx.sas.com (John W. DeBoskey) (09/07/90)

Hello netlanders,

   I'm working on a device driver, and had a use for the sprintf()
function which I promptly found out doesn't exist in the kernel, and
is just a munged call to printf anyways... A coworker mentioned using
the function ksprintf(), but I couldn't find it either. So,
hence my question.

   Does Interactive Unix, Version 1.0.6 have an internal function
that does the same as sprintf()?

   As a 2nd question, is there a GOOD AT&T manual specifically
written for the 386 Unix environment, covering kernel routines
and their interfaces, and possibly the differences between
versions?

                                   Thanks Much!
                                     John W De Boskey

jwd@unx.sas.com       (w) rti.rti.org!sas!jwd       (919) 677-8000 x6915
jwd@baggins.ral.nc.us (h) mcnc.mcnc.org!baggins!jwd (919) 481-1057 (preferred)

buck@siswat.UUCP (A. Lester Buck) (09/09/90)

In article <1990Sep07.162127.9827@unx.sas.com>, jwd@unx.sas.com (John W. DeBoskey) writes:
> Hello netlanders,
> 
>    I'm working on a device driver, and had a use for the sprintf()
> function which I promptly found out doesn't exist in the kernel, and
> is just a munged call to printf anyways... A coworker mentioned using
> the function ksprintf(), but I couldn't find it either. So,
> hence my question.
> 
>    Does Interactive Unix, Version 1.0.6 have an internal function
> that does the same as sprintf()?

Do you really _need_ a full blown sprintf()?  Hard to imagine a driver
that must have such a thing, especially when you can cobble up
the specific piece you need pretty fast.  But if you are just dying
for an sprintf, the cover of the September "C Users Journal" has
a story "Write a Custom printf()", which should be what you want.
Or pick up one of the half dozen versions of printf in the archives.
I wouldn't want to depend on any vendor specific sprintf routine
in the kernel - what a pain to move your driver to the next
platform.

>    As a 2nd question, is there a GOOD AT&T manual specifically
> written for the 386 Unix environment, covering kernel routines
> and their interfaces, and possibly the differences between
> versions?
> 
> jwd@unx.sas.com       (w) rti.rti.org!sas!jwd       (919) 677-8000 x6915
> jwd@baggins.ral.nc.us (h) mcnc.mcnc.org!baggins!jwd (919) 481-1057 (preferred)

Here is Yet Another posting of the AT&T driver manuals available.  I bought
my versions of these about a year ago with the listed prices.
I think I read that the prices have about doubled. :-(

UNIX System V and V/386, Release 3, Block and Character Interface (BCI)
Driver Development Guide, Select Code 307-191 Issue 2, ~$100
    This is an excellent manual covering virtually every aspect of
    writing device drivers for Unix System V.  Approximately 600
    typeset 8.5x11 pages packed with useful information.  Even covers
    such nifty topics as applying Bentley's book, "Writing Efficient
    Programs", to iterating a network driver and making it run
    twice as fast.  Highly recommended.

UNIX System V and V/386, Release 3, Block and Character Interface (BCI)
Driver Reference Manual, Select Code 307-192 Issue 2, Preliminary, ~$70
    These are the kernel man pages, with examples.  Not as interesting
    as the development guide, but necessary. About 300 pages.

UNIX System V/386 Release 3.2 Integrated Software Development Guide (ISDG)
Select Code 307-072, ~$100
    This covers V/386 specific features, including kernel routines to
    do I/O, install scripts, man pages for driver install programs, sample
    386 drivers, etc.  Overpriced for what you get, but necessary. 
    About 150 small pages.  Reprinted by several Unix vendors
    (ISC, the old Bell Tech) and sold with their development system
    package, so someone you know might already have a copy you could borrow.

The book "Writing A Unix Device Driver" by Texiera and Egan also has a
lot of useful information, and the price is right, about $25.

-- 
A. Lester Buck    buck@siswat.lonestar.org  ...!uhnix1!lobster!siswat!buck

david@csource.oz.au (david nugent) (09/14/90)

>    I'm working on a device driver, and had a use for the sprintf()
> function which I promptly found out doesn't exist in the kernel, and
> is just a munged call to printf anyways... A coworker mentioned using
> the function ksprintf(), but I couldn't find it either. So,
> hence my question.

>    Does Interactive Unix, Version 1.0.6 have an internal function
> that does the same as sprintf()?

Never ran ISC 1.0.6, but "nm -p /unix | grep printf" on 2.2.0 comes up
with:

3490159168 T printf
3490161496 T errprintf
3490161532 T dri_printf
3490316160 D ipprintfs
3490319756 D tcpprintfs

So it appears that the current kernel does include it.  You might do
something similar with yours to see what it reveals.


david

-- 

        Fidonet: 3:632/348   SIGnet: 28:4100/1  Imex: 90:833/387
              Data:  +61-3-885-7864   Voice: +61-3-826-6711
 Internet/ACSnet: david@csource.oz.au    Uucp: ..!uunet!munnari!csource!david