[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: Why Dprintk(printf) doesn't work in user space modules?



Hi, Robert

I'm very glad to receive your reply. You know, I seldom receive response
from TUX-list about my
questions.I guess TUX will become more popular only if more people know how
to develop their own
user space modules.

Can you tell me which function I can use to write the debugging information
to text file
from my user space modules?

Thank you.

Liang


-----Original Message-----
From: tux-list-admin@redhat.com [mailto:tux-list-admin@redhat.com]On
Behalf Of Robert S. Nasby
Sent: Monday, March 25, 2002 2:09 PM
To: tux-list@redhat.com
Subject: RE: Why Dprintk(printf) doesn't work in user space modules?


This is just a guess, but I would assume that all printf statements would go
nowhere.  I would assume that stdout is being set to null, so that printf
would not work.  You might want to have it write out to a text file instead.

Rob

-----Original Message-----
From: tux-list-admin@redhat.com [mailto:tux-list-admin@redhat.com]On Behalf
Of Liang Yang
Sent: Sunday, March 24, 2002 11:27 AM
To: tux-list@redhat.com
Subject: Why Dprintk(printf) doesn't work in user space modules?


Hi,
I want to output the value of variables in my user space module for the
debugging purpose, I try to use printf or Dprintk(actually it is a macro
definiton of printf). But I can't find where the output goes. It doesn't
appear on the console windows , nor does it be logged in the
/var/www/log/messages.

If I use write(req->sock,...), I can find the output information in the
web page.

I enabled CONFIG_TUX_DEBUG and rebuild the kernel and set the Dprintk
and all_userspace in /proc/sys/net/tux. But Dprintk or printf still
doesn't work.

Usually printf will output the information to the screen, does TUX
changes the output direction of printf? I know for TUX itself, it use
Dprintk based on printk since it is a kernel space dameon, but for all
user space module programs, Dprintk is implemented by printf. How can
printf print information to syslog? You can find the definition of
Dprintk for user modules in tuxmodule.h in /usr/include. I found another
very strange thing in tuxmodule.h, just look this(pasted from
tuxmodule.h). TUX_DEBUG is defined 0 by default, e.g. Dprintk do
nothing. So should I change the
value of TUX_DEBUG from 0 to 1 before I compile my user space module
program if want to output some debugging information?

#define TUX_DEBUG 0

#if TUX_DEBUG
# define Dprintk(x...) do { printf(x); fflush(stdout); } while (0)
#else
# define Dprintk(x...) do { } while (0)
#endif


Liang



_______________________________________________
tux-list mailing list
tux-list@redhat.com
https://listman.redhat.com/mailman/listinfo/tux-list



_______________________________________________
tux-list mailing list
tux-list@redhat.com
https://listman.redhat.com/mailman/listinfo/tux-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []