Solaris STREAMS modules and strlog(9F)

Solaris STREAMS modules and strlog(9F)

Post by Alex » Thu, 19 Jun 2003 18:41:18



Hi, all!
I'm writing a STREAMS module (Solaris 9 SPARC) and got the following
problem: i want to write the contents of ordinary messages into file for
  further analyze.
What is the best way to do it?
I tried to make this with help of strlog(9F), but failed:(
What exactly i did:
1) Run strerr
2) In the source of module (in rput func)

static void
traffcut_rput(queue_t *q, mblk_t *mp)
{
/*added by  you_know_who   for module logging*/
        size_t dbbuflen;
        int count;
        unsigned char *myptr;
        mblk_t *bp;

switch (mp->b_datap->db_type) {

case M_DATA: /* We need 2 log only ordinary data messages*/

        count=0;

        for (bp = mp; bp != NULL; bp = bp->b_cont) {
                count++;
        }

        strlog(info.mi_idnum,0,0,SL_NOTE,"%s %d %s","NEW ORDINARY                        MESSAGE:
",count," BLOCKS" );

        count=0;
        for (bp = mp; bp != NULL; bp = bp->b_cont) {

                /*Computation of data block buffer size*/
        count++;
        dbbuflen=(size_t)(bp->b_datap->db_lim-bp->b_datap->db_base);
        strlog(info.mi_idnum,0,0,SL_NOTE,"%s %d %s %d %s","BLOCK ",count,"
:SIZE=", dbbuflen," bytes.");
        strlog(info.mi_idnum,0,0,SL_NOTE,"%s","CONTENTS: ");
        myptr=bp->b_datap->db_base;

                while(myptr++<bp->b_datap->db_lim) {

                        strlog(info.mi_idnum,0,0,SL_NOTE,"0x%x     ",(unsigned int)(*myptr));
                }

        strlog(info.mi_idnum,0,0,SL_NOTE,"%s %d","END OF BLOCK ",count);

        }

        strlog(info.mi_idnum,0,0,SL_NOTE,"%s","END OF MESSAGE");
        putnext(q, mp);
        break;

default:
        putnext(q, mp);
        break;

Quote:}
}

3) It compiles with no problem and it works, but i didn't see any files
in /var/adm/streams/  as it should be ( at least man page strlog(9F)
said so)
4) What is the problem?
5)Thank every one who can help.

P.S. I think that it might be problem with /dev/hands:)

 
 
 

1. Solaris x86 failure to push streams module into network stream

I just build a streams driver module. It was installed into the system
with add_drv and loaded with modload. I also set up a device in the
/devices and /dev for it. When I try to install it into my network
stream I get the following message.


ifconfig: fail to insert module: base: Invalid argument

It appears that the module "base" cannot be found. Any suggestions?

Steve West

2. mouse won't go beyond line 25 w/ SVGATextMode

3. copyin(9F) in streams driver?

4. X monitor/tracer wanted for debugging

5. What happens if a stream module is pushed onto multiple stream driver?

6. FTP port problem

7. How to push STREAMS module into socket stream

8. Error logs from SCSI tape (Exabyte DAT in particular)

9. Debugging Solaris STREAMS modules

10. Solaris STREAMS null module

11. How to install a STREAMS module in Solaris 8?

12. Solaris 7 and 8 STREAMs modules

13. Solaris 10(Sparc) Fireengine push another stream module