*BSD News Article 98013


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!news.mathworks.com!enews.sgi.com!news.sgi.com!csulb.edu!drivel.ics.uci.edu!news.cs.ucla.edu!not-for-mail
From: Renaud Bruyeron <bruyeron@cs.ucla.edu>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: kernel traces
Date: 18 Jun 1997 19:50:19 GMT
Organization: UCLA Computer Science Dept.
Lines: 14
Message-ID: <5o9e5r$1ar@delphi.cs.ucla.edu>
NNTP-Posting-Host: cheetah.cs.ucla.edu
X-Newsreader: TIN [UNIX 1.3 unoff BETA release 970120]
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:43142

I am working on TCP, and I need to plot some state variables from the TCP code on FreeBSD 2.1.6. Those variables are not available through netstat, therefore I try to 'print' these variables, since I was told printf defaults to /var/log/message within the kernel.
Even though I don't like the idea to use printf within this kind of code, I tried to, but was enable to find the result of the output anywhere:

if( (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)  )
  printf(";TCP_VARS: cwnd=%d",tp->snd_cwnd);

I inserted this piece of code at some intereting points in tcp_input.c, and I tried to enable SO_DEBUG with a setsockopt() call, but it does not work.

Is there any kernel guru out there who could help me ? Is printf the normal way to go for this purpose (what about klog and log ?)


Thanks for your help,

 - Renaud