LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-11-2004, 11:00 PM   #1
linshu
LQ Newbie
 
Registered: Mar 2003
Posts: 4

Rep: Reputation: 0
Question output of printk can NOT be found in /var/log/messages


I am debugging a module like below. I can get the printk output in
/var/log/messages when i insmod and rmmmod. But when i try to open or
ioctl the device, the output of printk doesn't appear in
/var/log/messages.

What did i do wrong? Thanks ahead!
Shu

Below is the code:

...

#define ix_ossl_message_log(arg_pFmtString,args...)
(printk(arg_pFmtString, ## args),IX_SUCCESS)

...

static struct file_operations ix_sa_fops = {
ioctl: ix_sa_ioctl,
open: ix_sa_open,
release: ix_sa_close,
};

int majorNumber = DEV_NUMBER_SAUTIL;

int init_module(void)
{

ix_uint32 s_Result;

#ifdef IX_DEBUG
ix_ossl_message_log("Loading sysapp_common module.\n");
#endif


s_Result = register_chrdev(majorNumber, DEV_NAME_SAUTIL,
&ix_sa_fops );
if(s_Result == 0)
{
ix_ossl_message_log("UtilDrv Module is registered with
major:%d\n",majorNumber);
ix_ossl_message_log ("USAGE:\n");
ix_ossl_message_log ("mknod /dev/%s c %d <minor>\n",
DEV_NAME_SAUTIL, majorNumber);
ix_ossl_message_log ("with different minor numbers.\n\n");

}
else
{
ix_ossl_message_log( "sysapp_common module cannot be
registered!!!!.\n");
ix_ossl_message_log("Registered to number
%d\n",majorNumber);
return -1;
}

return 0;
}

void cleanup_module(void)
{
ix_uint32 s_Result;

#ifdef IX_DEBUG
ix_ossl_message_log("Unloading sysapp_common module.\n");
#endif

s_Result = unregister_chrdev(majorNumber, DEV_NAME_SAUTIL);
if(s_Result == 0)
{
ix_ossl_message_log("sysapp_common module cleaned
successfully...\n");
}
else
{
ix_ossl_message_log("sysapp_common Module COULD NOT BE CLEANED
UP !!!\n");
}

return;
}



int ix_sa_open(
struct inode *sa_inode,
struct file *sa_file)
{
#ifdef IX_DEBUG
ix_ossl_message_log("ix_sa_open called.\n");
#endif
return 0;

}




int ix_sa_close(
struct inode *sa_inode,
struct file *sa_file)
{
#ifdef IX_DEBUG
ix_ossl_message_log("ix_sa_close called.\n");
#endif
return 0;
}



int ix_sa_ioctl(
struct inode *sa_inode,
struct file * sa_file,
unsigned int cmd,
unsigned long arg_IoctlPtr)
{
ix_uint32 s_Result;

#ifdef IX_DEBUG
ix_ossl_message_log("ix_sa_ioctl called.\n");
#endif

if (sa_inode == NULL)
{
#ifdef IX_DEBUG
ix_ossl_message_log("ix_sa_inode is NULL.\n");
#endif
return -1;
}

if (sa_file == NULL)
{
#ifdef IX_DEBUG
ix_ossl_message_log("ix_sa_file is NULL.\n");
#endif
return -1;
}

switch(cmd)
{
case SA_START:
s_Result = _ix_sa_entry((void *)arg_IoctlPtr);
break;
case SA_STOP:
s_Result = ix_sa_shutdown(0);
break;

default:
#ifdef IX_DEBUG
ix_ossl_message_log("Undefined ioctl command %d.\n", cmd);
#endif
s_Result = -1;
break;
}

if (s_Result != 0)
{
#ifdef IX_DEBUG
ix_ossl_message_log("ix_sa_ioctl failed.\n");
#endif
}
else
{
#ifdef IX_DEBUG
ix_ossl_message_log("ix_sa_ioctl succeeded.\n");
#endif
}

return s_Result;

}
 
Old 02-13-2004, 09:06 AM   #2
linshu
LQ Newbie
 
Registered: Mar 2003
Posts: 4

Original Poster
Rep: Reputation: 0
Unhappy Dump /proc/sys/kernel/printk and /etc/syslog.conf below

Is any configuration wrong?
Dump /proc/sys/kernel/printk and /etc/syslog.conf below:

[root@insighter root]# cat /proc/sys/kernel/printk
6 4 1 7
[root@insighter root]# cat /etc/syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages

# The authpriv file has restricted access.
authpriv.* /var/log/secure

# Log all the mail messages in one place.
mail.* /var/log/maillog


# Log cron stuff
cron.* /var/log/cron

# Everybody gets emergency messages
*.emerg *

# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler

# Save boot messages also to boot.log
local7.* /var/log/boot.log
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what does messages suppressed in /var/log/messages mean saavik Linux - Networking 2 05-07-2008 02:31 PM
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 06:39 PM
From where am i getting error messages to /var/log/messages? prabhuacsp Linux - Networking 1 02-16-2005 12:34 AM
No output to /var/log/messages or ~syslog eelriver Slackware 5 07-18-2004 05:13 AM
/var/log/messages full of these messages. Should I be concerned? mdavis Linux - Security 5 04-16-2004 10:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration