<- Back

Archived post: Investor Village, "STREAMS: gotta catch 'em all!"

Researched and posted 8 Aug, 2006

I've done just a little wordsmithing since I put this up at Investor Village.

Message:  3661 of 3713 posted 8/9/2006 2:07:00 AM
Recommend     Hide Post      Add to Favorites      Report Abuse
Author:  infosecgroupie       Send PM      Ignore     View Profile Recs: 20
Subject:   STREAMS: gotta catch 'em all
Sentiment:

Well.

Well, well.

It seems that right at this very moment (to wit: Tue Aug  8 22:36:31 PDT 2006) TSCOG is making available from its ftp site ftp://ftp2.caldera.com/pub/Skunk96/UnixWare/FreeBird/hints/Development/Sample_Source/ the following:

Sample Source Code For UnixWare
-------------------------------

Part of the SDK contains sample source code - here are some others
we've found which may be of use.

Device_Drivers.tar
------------------

This contains sample device drivers and a sample STREAMS based driver


Well.

" ... a sample STREAMS based driver ... "

huh..

We've killed the Elf issue, but here's the other alleged biggie, STREAMS.

File: Device_Drivers.tar 189 KB 06/02/2001 12:00:00 AM

which, when tar xvf'd produces:

~/UW312.examples

and within which we find, among other files, dd_streams --  which begins:

/* The following code fragment demonstrates the new open() routine interface
   for STREAMS drivers. In addition, it identifies the following features
   of V4.x based drivers:
        1) Method for identifying privileged process.
        2) Uses of getmajor() and getminor() to support a much larger set
                of minor numbers.
        3) Support for clone devices.
        4) New method of returning error codes.
        5) Ways to create new device nodes. (makedevice()).
        6) Mechanism to enable and disable put() and service() procedures.
*/

under
~/UW312.examples

we find ~/UW312.examples/STREAMS

wherein we find a README:

#ident  "@(#)kit:eth/README     1.3"

This started life as part of the IHV development kit.
I have taken the body out of this and made a bare STREAMS
driver, it does nothing...it just has all the bits.

As a result there may be some spurious bits of code left in place.
However it does build and it does load and run, there is a simple
exercise program.

Graeme@novell.co.uk

------- Original README updated to reflect nop changes ---------

This DLPI/ethernet development kit contains the following
directories:

src:

        Contains complete source for a sample nop driver,
        it does nothing just shows the guts of a STREAMS driver.
        It can be built and loaded into a running kernel.

        To make the driver use:

                make -f nop.mk

        This must be done on a 386 AT type machine running
        UNIX(R) SVR4.2.


<snip>

OK. So under ~/UW312.examples/STREAMS/src we find nopstream.c again, among other files...

/*
 * This is the  STREAMS device driver for NOP.
 *
 * Here we assume there is a NOP device (no-Operation) which
 * has a controller board which interrupts.
 *
 * 1: NOP is just the device driver, not a stream module.
 *
 * 2: Three files:
 *    nopstream.c - This file contains just STREAM routines
 *    nopinit.c   - The initalise and load/unload code
 *    nophrdw.c   - Hardware related code. In particular the interrupts
 */

/*
 * This is where the driver fits in:
 *
 *  +---------------------------+
 *  | STREAM Head               |
 *  +---------------------------+
 *        ^                |
 *        |                v
 *
 *  Other (possible) STREAM modules
 *
 *
 *  Read Side        Write side
 *        ^                |
 *        |                |
 *        |                v
 *  +----------+     +----------+   \
 *  |          |     |          |   |
 *  |          |     |          |   |== We are here
 *  |          |     |          |   |
 *  +----------+     +----------+   /
 *       | (intr)         |
 *  +---------------------------+
 *  | Hardware board            |
 *  +---------------------------+
 *
 *
 * We connect to the rest of the OS at several points:
 *
 *
 * -> nop_load   - Called when driver is dynamicly loaded
 *
 *

 * -> nop_unload - Called when driver is dynamicly unloaded
 *
 * -> nop_open   - Called to open device
 *
 * -> nop_close  - Called to close device
 *
 * -> nopwput    - Called When data is to be written to device
 *
 * -> noprsvr    - Called every so often, when read data can serviced
 *
 * -> nopintr    - Called When device sends interrupt
 */

#include "nop.h"

/* The STREAMS routines:
 *
 * nopopen  - Attached to read side, called when user does open()
 * nopclose - Attached to read side, called when user does close().
 *
 * nopwput  - The Write side put routine, called when user does a write.
 * noprsrv  - The Read  side service routine, scheduled to run AFTER data
 *            has arrived (often via INTERRUPT routine).
 *
 *
 */

<snippage>


Gee.. I dunno...

It sure seem to me that TSCOG is distributing source code that intends to demonstrate how to write " ... a bare STREAMS
driver, it does nothing...it just has all the bits ... "

Isn't that the damndest thing!


i_s_g


<- Back


jsage@finchhaven.com
Last modified: Wed Aug 9 09:39:08 2006