home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / programm / 4287 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  2.6 KB

  1. Xref: sparky comp.unix.programmer:4287 comp.unix.internals:1687
  2. Newsgroups: comp.unix.programmer,comp.unix.internals
  3. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!jrd.dec.com!doi
  4. From: doi@jrd.dec.com (Hitoshi Doi)
  5. Subject: Re: debugging streams
  6. Message-ID: <Bsy1An.HuM@jrd.dec.com>
  7. Sender: usenet@jrd.dec.com (USENET News System)
  8. Nntp-Posting-Host: usagi.jrd.dec.com
  9. Organization: DEC Japan Research and Development Center
  10. References:  <35489@arctic.nprdc.navy.mil>
  11. Date: Thu, 13 Aug 1992 22:32:47 GMT
  12. Lines: 59
  13.  
  14. In article <35489@arctic.nprdc.navy.mil>, stanonik@nprdc.navy.mil (Ron Stanonik) writes:
  15. # We're trying to track down a problem with a serial port.
  16.  
  17. [..stuff deleted here and there..]
  18.  
  19. # We'd like to "see" what's being passed between ldterm and fxm.
  20. # ldterm and fxm don't seem to be strlog'ing anything; ie, neither
  21. # strace nor sterr produce any output.  Is there anything we can push
  22. # between ldterm and fxm to "see" what's being passed?
  23.  
  24. It is very easy to write a filter module that you can push anywhere
  25. that will strlog (or printf) the messages that are going around.
  26. Something like the following.  Please add details to suit your needs.
  27.  
  28. mfilter_open(..)  { return 0; }
  29. mfilter_close(..)  { return 0; }
  30. mfilter_rput(queue_t *q, mblk_t *mp)
  31. {
  32.     struct iocblk *iocp;
  33.     switch (mp->b_datap->db_type) {
  34.     case M_DATA:
  35.         strlog(MID, SID, 0, 1, SL_ERROR, "READ: M_DATA: %d chars",
  36.             mp->b_wptr - mp->b_rptr);
  37.         break;
  38.     case M_IOCNAK:
  39.         iocp = (struct iocblk *)mp->b_rptr;
  40.         strlog(MID, SID, 0, 1, SL_ERROR, "READ: M_IOCNAK: %x", iocp->ioc_cmd);
  41.         break;
  42.     case M_IOCACK:
  43.         iocp = (struct iocblk *)mp->b_rptr;
  44.         strlog(MID, SID, 0, 1, SL_ERROR, "READ: M_IOCACK: %x", iocp->ioc_cmd);
  45.         break;
  46.     ....
  47.     }
  48.     putnext(q, mp);
  49.     return 0;
  50. }
  51. mfilter_wput(queue_t *q, mblk_t *mp)
  52. {
  53.     struct iocblk *iocp;
  54.     switch (mp->b_datap->db_type) {
  55.     case M_DATA:
  56.         strlog(MID, SID, 0, 1, SL_ERROR, "WRITE: M_DATA: %d chars",
  57.             mp->b_wptr - mp->b_rptr);
  58.         break;
  59.     case M_IOCTL:
  60.         iocp = (struct iocblk *)mp->b_rptr;
  61.         strlog(MID, SID, 0, 1, SL_ERROR, "WRITE: M_IOCTL: %x", iocp->ioc_cmd);
  62.         break;
  63.     ....
  64.     }
  65.     putnext(q, mp);
  66.     return 0;
  67. }
  68.  
  69. --
  70. Hitoshi Doi, International Open Systems Engineering        doi@jrd.dec.com
  71. Japan Research and Development Center               decwrl!jrd.dec.com!doi
  72. Digital Equipment Corporation Japan          [from Japan: doi@dec-j.co.jp]
  73.