LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   output of printk can NOT be found in /var/log/messages (http://www.linuxquestions.org/questions/linux-software-2/output-of-printk-can-not-be-found-in-var-log-messages-145084/)

linshu 02-11-2004 11:00 PM

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;

}

linshu 02-13-2004 09:06 AM

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


All times are GMT -5. The time now is 06:52 PM.